Bug 2154 - Fetcher problems
Summary: Fetcher problems
Status: RESOLVED FIXED
Alias: None
Product: Meta-yocto
Classification: Build System, Metadata & Runtime
Component: meta-yocto (show other bugs)
Version: 1.2
Hardware: x86 Multiple
: High critical
Target Milestone: 1.2 M4
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2012-03-22 13:48 UTC by Gary Thomas
Modified: 2012-03-24 16:32 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments
Console log showing fetch failure (8.76 KB, text/x-log)
2012-03-22 13:48 UTC, Gary Thomas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gary Thomas 2012-03-22 13:48:24 UTC
Created attachment 386 [details]
Console log showing fetch failure

Tested with 1.2 beta of 2012-03-21
Build host is Fedora 13, i386

This error is similar to #1866, but I think I understand what's happening and can give a way to force it to happen.

With this beta release, I have seen a lot of fetcher errors.  I'm using an existing source cache, so I set
  DL_DIR="/local/yocto-beta/sources/"
in local.conf

Many recipes fail with messages like this:
NOTE: package matchbox-panel-2-0.0+git1+cdf7a22716b87468f10573f622d5c7a58a684e35-r4: task do_fetch: Started
WARNING: Failed to fetch URL git://git.yoctoproject.org/matchbox-panel-2;protocol=git
ERROR: Fetcher failure: Fetch command export HOME="/home/gthomas"; export GIT_CONFIG="/home/local/qemuarm_yocto/tmp/sysroots/i686-linux/etc/gitconfig"; export PATH="/home/local/qemuarm_yocto/tmp/sysroots/i686-linux/usr/bin/armv5te-poky-linux-gnueabi:/home/local/qemuarm_yocto/tmp/sysroots/qemuarm/usr/bin/crossscripts:/home/local/qemuarm_yocto/tmp/sysroots/i686-linux/usr/sbin:/home/local/qemuarm_yocto/tmp/sysroots/i686-linux/usr/bin:/home/local/qemuarm_yocto/tmp/sysroots/i686-linux/sbin:/home/local/qemuarm_yocto/tmp/sysroots/i686-linux//bin:/home/local/yocto-beta/scripts:/home/local/yocto-beta/bitbake/bin/:/opt/amltd/bin:/usr/java/jdk1.6.0_10/bin:/home/gthomas/Android/android-sdk-linux_x86-1.1_r1/tools:/home/gthomas/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/local/yocto-beta/scripts"; tar -xzf /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz could not be run:
None

This happens if there is an existing tarball with a different size than the  file on the mirror in ${DL_DIR}.  I have these from running with
  BB_GENERATE_MIRROR_TARBALLS ?= "1"

So, for example, my DL_DIR has this file:
-rw-rw-r-- 1 gthomas gthomas 243763 Mar 16 06:22 /local/poky-multi/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
This file will unpack properly when I build my normal system (master + own-mirrors pointing to my source cache)

I can make it fail with the beta setup (no own-mirrors, only DL_DIR set) like this:
  % cp /local/poky-multi/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz /local/yocto-beta/sources
  % rm -fr /local/yocto-beta/sources/git2
  % bitbake matchbox-panel-2 -c cleansstate
  % bitbake matchbox-panel-2 -c fetch

After this fails, I see that the file I copied has been replaced 
-rw-rw-r-- 1 gthomas gthomas 245303 Sep  2  2011 /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
However, this file is damaged:
$ tar -ztvf /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
./
./refs/
./refs/heads/
./refs/tags/
./HEAD
./hooks/
./hooks/pre-commit.sample
./hooks/pre-rebase.sample
./hooks/applypatch-msg.sample
./hooks/commit-msg.sample
./hooks/update.sample
./hooks/pre-applypatch.sample
./hooks/post-update.sample
./hooks/prepare-commit-msg.sample
./config
./packed-refs
./objects/
./objects/pack/
./objects/pack/pack-bfaa469b61b0736f3af7f2591f5f127a0e78cc80.idx
./objects/pack/pack-bfaa469b61b0736f3af7f2591f5f127a0e78cc80.pack
gzip: stdin: decompression OK, trailing garbage ignored
./objects/info/
./info/
./info/exclude
./branches/
./description
% md5sum /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz 
d1ab695536afc139f8d3b78dc49c674d  /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
% ls -l /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz 
-rw-rw-r-- 1 gthomas gthomas 245303 Sep  2  2011 /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz

If I run the same scenario like this, it works:
  % rm -f /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
  % rm -fr /local/yocto-beta/sources/git2
  % bitbake matchbox-panel-2 -c cleansstate
  % bitbake matchbox-panel-2 -c fetch
The truly strange thing is this:
  % md5sum /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz 
9e203112f7e7688ccab1ac2f64feb162  /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz
  % ls -l /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz 
-rw-rw-r-- 1 gthomas gthomas 245303 Sep  2  2011 /local/yocto-beta/sources/git2_git.yoctoproject.org.matchbox-panel-2.tar.gz

The file has the same size and time/date, but the contents are different!
I've attached the complete console log of this process to this bug

I'll also investigate if this is host specific
Comment 1 Gary Thomas 2012-03-22 15:24:37 UTC
Verified that this scenario also fails on other hosts
  Fedora 16, i386
  Ubuntu 11.10, x86_64
so the problem does not seem to be host related.
Comment 2 Richard Purdie 2012-03-23 14:55:28 UTC
What is happening is its running wget against something which isn't necessarily the same file. I've pushed some fixes which add some stamps to ensure this doesn't happen:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=3d69d9462d550ce4e00e14768cc616bc9ad7e8a5
Comment 3 Gary Thomas 2012-03-23 15:11:20 UTC
(In reply to comment #2)
> What is happening is its running wget against something which isn't necessarily
> the same file. I've pushed some fixes which add some stamps to ensure this
> doesn't happen:
> 
> http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=3d69d9462d550ce4e00e14768cc616bc9ad7e8a5

This change doesn't fix the problem with an existing DL_DIR if the file has no .done stamp.  Perhaps that should be documented?  or maybe some other mechanism?

Note: My DL_DIR is used all the time with own-mirrors and I keep no .done stamps, so the difference in behaviour is pretty confusing.
Comment 4 Richard Purdie 2012-03-24 00:38:23 UTC
I can't come up with any reasonable solution to deal with existing corrupted files in downloads. The user will just have to clean them out. Thankfully the setup to get into that state is rare as we've not seen people reporting this apart from this bug. The fix will ensure it doesn't happen again.

If you remove the done stamps from DL_DIR, it will hit the network and also re-checksum all your downloads each time. I'd not recommend deleting them even if it appears to work.
Comment 5 Gary Thomas 2012-03-24 11:55:46 UTC
(In reply to comment #4)
> I can't come up with any reasonable solution to deal with existing corrupted
> files in downloads. The user will just have to clean them out. Thankfully the
> setup to get into that state is rare as we've not seen people reporting this
> apart from this bug. The fix will ensure it doesn't happen again.
> 
> If you remove the done stamps from DL_DIR, it will hit the network and also
> re-checksum all your downloads each time. I'd not recommend deleting them even
> if it appears to work.

That's just the thing though - these files are not corrupted before you run the fetcher step.  As I've said, they work perfectly when used with own-mirrors and were created locally by that process when I use BB_GENERATE_MIRROR_TARBALLS ?= "1"

It's the fact that my local copy is not the same file (size?) as the Yocto mirror version causes the wget to be executed and that corrupts the file.  Either we all have to get the tarballs from the Yocto mirror (don't like this, sorry) or it should be fixed.  I think the wget is being run when it needs not to be.
Comment 6 Richard Purdie 2012-03-24 16:32:12 UTC
If the .done file is there it will use them as is. The .done stamps are created by the fetcher to tell the difference between "this file has been completely downloaded" and "the machine lost power halfway through" since we have no idea what the size of checksum of a mirror tarball should be in the general case.

Please either:

a) let bitbake get the files from some mirror (even a local file:// url) rather than putting files yourself
b) Accept you need to create the .done files (which bitbake will now do when it generates tarballs with BB_GENERATE_MIRROR_TARBALLS)