Race condition in py_compile corrupts pyc files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python2.7 (Ubuntu) |
High
|
Barry Warsaw | |||
Precise |
High
|
Barry Warsaw | |||
Quantal |
High
|
Barry Warsaw | |||
Raring |
High
|
Barry Warsaw | |||
Saucy |
High
|
Barry Warsaw | |||
python3.2 (Ubuntu) |
Undecided
|
Unassigned | |||
Precise |
High
|
Barry Warsaw | |||
Quantal |
High
|
Barry Warsaw | |||
Raring |
Undecided
|
Unassigned | |||
Saucy |
Undecided
|
Unassigned | |||
python3.3 (Ubuntu) |
High
|
Barry Warsaw | |||
Precise |
Undecided
|
Unassigned | |||
Quantal |
Undecided
|
Unassigned | |||
Raring |
High
|
Barry Warsaw | |||
Saucy |
High
|
Barry Warsaw |
Bug Description
yeay for automatic bug reporting!
this is happening pretty regular, I have no idea what's triggering it, a cron job maybe?
if I run it manually, it get:
~$ sudo do-release-upgrade
Traceback (most recent call last):
File "/usr/bin/
from DistUpgrade.
EOFError: EOF read where not expected
ProblemType: Crash
DistroRelease: Ubuntu 12.10
Package: ubuntu-
ProcVersionSign
Uname: Linux 3.5.0-16-generic x86_64
NonfreeKernelMo
ApportVersion: 2.5.3-0ubuntu1
Architecture: amd64
Date: Sat Sep 29 15:11:46 2012
ExecutablePath: /usr/bin/
InterpreterPath: /usr/bin/
PackageArchitec
ProcCmdline: /usr/bin/python3 /usr/lib/
ProcEnviron:
TERM=linux
PATH=(custom, no user)
PythonArgs: ['/usr/
SourcePackage: ubuntu-
Title: do-release-upgrade crashed with EOFError in /usr/lib/
Traceback:
Traceback (most recent call last):
File "/usr/lib/
from DistUpgrade.
EOFError: EOF read where not expected
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:
VarLogDistupgra
Related branches
Chris Weiss (cweiss) wrote : | #1 |
tags: | removed: need-duplicate-check |
Changed in ubuntu-release-upgrader (Ubuntu): | |
importance: | Undecided → Medium |
information type: | Private → Public |
Brian Murray (brian-murray) wrote : | #2 |
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | New → Incomplete |
Chris Weiss (cweiss) wrote : | #3 |
I get 431cb3e648b99dd
Chris Weiss (cweiss) wrote : | #4 |
issue has not returned, must have been fixed by some other commit
Launchpad Janitor (janitor) wrote : | #5 |
[Expired for ubuntu-
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | Incomplete → Expired |
dmiranda (dmiranda) wrote : | #6 |
I had this bug on two machines.
Reinstalling python3-distupgrade corrects the bug on both.
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | Expired → Confirmed |
Brian Murray (brian-murray) wrote : | #7 |
I did a search for some other EOFErrrors and found the following:
bdmurray@
bug-1035192/Description.
bug-1035192/Traceback.
bug-1039783/Description.
bug-1039783/Traceback.
bug-1061108/Description.
bug-1061108/Traceback.
bug-1093662/Description.
bug-853581/Description.
bug-853581/Traceback.
bug-950006/Description.
bug-950006/Description.
bug-950006/Description.
So I wonder if this error is indicative of a more general problem somewhere.
Changed in ubuntu-release-upgrader (Ubuntu): | |
importance: | Medium → Low |
Barry Warsaw (barry) wrote : | #8 |
This message comes from Python's built-in 'marshal' module, and it happens when EOF occurs unexpectedly while unmarshalling a string object. Marshal is the technology that underlies .pyc files, so this is only going to happen if you have corrupt .pyc files.
I have no idea what could be causing your .pyc files to be corrupted, but it's unlikely to be a problem in Python or do-release-upgrade. Perhaps you have a bad disk or some other hardware problem, or perhaps you're running on a weird or corrupted file system. E.g. problems with an encrypted disk or RAID could cause this. It's possible that a full file system at the time of package installation or upgrade could also cause such problems.
There's probably nothing we can do about it except to recommend that you re-install the affected packages. This will cause Python to re-byte compile the py files into new pyc files, hopefully fixing the corruption.
I'm going to mark this as Incomplete, but if you find a way to reliably reproduce this, and can discount hardware or filesystem problems, feel free to re-open it. If you can identify a corrupt .pyc file, please attach it - it would be interesting to pick that apart.
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | Confirmed → Incomplete |
Chris Weiss (cweiss) wrote : | #9 |
I don't agree that it's incomplete. there exists possibility that python3-distupgrade will fail to properly install but not provide any error, despite the md5sum being wrong. re-installing corrects it.
I can say with absolute certainty that my hardware was not at fault. no other packages had an issue, and re-install worked for reasons I do not understand.
the question is, why does it allow a file to have the wrong md5sum and not at least complain about it?
Barry Warsaw (barry) wrote : | #10 |
Note that .pyc files are not included in the packaging, they are produced at install time, so they don't contribute to any checksums. The .py files do, but these aren't what trigger the error message.
The reason for this is that at package build time, you don't know what versions of Python may be installed on the target system, and .pyc files are Python version specific. IOW, a .pyc file built for Python 3.2 is not guaranteed to work for 3.3.
AFAICT, what must have happened is that when a package was installed, and its pyc file was being written, *something* caused the pyc file to be truncated. The question is what though? Re-installing fixes the problem because the .pyc files are re-built at that time. Thus the corruption went away.
If it's not a file system problem or a hardware problem, I'm not sure what it could be. Another thing to note is that Python does its best to write a new .pyc file atomically, so I can't see how this could be a race condition (e.g. one process trying to read a .pyc file while the installation process is writing it). Plus, if the write fails you won't get a bogus .pyc file *and* you'd get an exception.
Barry Warsaw (barry) wrote : | #11 |
Actually: http://
And I think I'm wrong. pyc files are written atomically in Python 3.3, but afaict that's not the case in Python 3.2. The import machinery was rewritten in Python for 3.3. So this could be a race condition for earlier Pythons.
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | Incomplete → Triaged |
Barry Warsaw (barry) wrote : | #12 |
I still think this isn't the whole story. Even if pyc files aren't written atomically before Python 3.3, it still seems like the race condition window is exceedingly small. I don't have any brilliant ideas about what could be going wrong and haven't ever seen it myself or know how to reproduce it.
Brian Murray (brian-murray) wrote : | #13 |
Only three of the similar bugs have dmesg information (which may show hardware errors) included and there was nothing denoting a hardware error in them. However, it makes me think we should be collecting something similar to currentdmesg with release upgrade bug reports.
Brian Murray (brian-murray) wrote : | #14 |
This is also being tracked in bug 1093071.
Changed in ubuntu-release-upgrader (Ubuntu): | |
assignee: | nobody → Barry Warsaw (barry) |
importance: | Low → High |
status: | Triaged → In Progress |
affects: | ubuntu-release-upgrader (Ubuntu) → python2.7 (Ubuntu) |
Changed in python2.7 (Ubuntu): | |
assignee: | Barry Warsaw (barry) → nobody |
Changed in python3.3 (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
Changed in python2.7 (Ubuntu): | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in python3.3 (Ubuntu): | |
assignee: | nobody → Barry Warsaw (barry) |
summary: |
- do-release-upgrade crashed with EOFError in /usr/lib/ubuntu-release- - upgrader/check-new-release: EOF read where not expected + Race condition in py_compile corrupts pyc files |
Changed in python3.2 (Ubuntu Raring): | |
status: | New → Invalid |
Changed in python3.2 (Ubuntu Saucy): | |
status: | New → Invalid |
Changed in python3.3 (Ubuntu Precise): | |
status: | New → Invalid |
Launchpad Janitor (janitor) wrote : | #15 |
Status changed to 'Confirmed' because the bug affects multiple users.
Changed in python2.7 (Ubuntu Precise): | |
status: | New → Confirmed |
Changed in python2.7 (Ubuntu Raring): | |
status: | New → Confirmed |
Changed in python3.2 (Ubuntu Precise): | |
status: | New → Confirmed |
Changed in python3.3 (Ubuntu Raring): | |
status: | New → Confirmed |
Launchpad Janitor (janitor) wrote : | #19 |
This bug was fixed in the package python3.3 - 3.3.2-1ubuntu3
---------------
python3.3 (3.3.2-1ubuntu3) saucy; urgency=low
* debian/
conditions when writing .pyc/.pyo files in py_compile.py.
Issue #13146. LP: #1058884
-- Barry Warsaw <email address hidden> Tue, 21 May 2013 15:13:37 -0400
Changed in python3.3 (Ubuntu Saucy): | |
status: | In Progress → Fix Released |
Launchpad Janitor (janitor) wrote : | #20 |
This bug was fixed in the package python2.7 - 2.7.5-1ubuntu2
---------------
python2.7 (2.7.5-1ubuntu2) saucy; urgency=low
* debian/
conditions when writing .pyc/.pyo files in py_compile.py.
Issue #13146. LP: #1058884
-- Barry Warsaw <email address hidden> Tue, 21 May 2013 11:08:08 -0400
Changed in python2.7 (Ubuntu Saucy): | |
status: | In Progress → Fix Released |
Changed in python2.7 (Ubuntu Precise): | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in python2.7 (Ubuntu Raring): | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in python3.2 (Ubuntu Precise): | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in python3.3 (Ubuntu Raring): | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in python2.7 (Ubuntu Raring): | |
status: | Confirmed → In Progress |
Changed in python2.7 (Ubuntu Quantal): | |
assignee: | nobody → Barry Warsaw (barry) |
importance: | Undecided → High |
status: | New → In Progress |
Changed in python2.7 (Ubuntu Precise): | |
importance: | Undecided → High |
status: | Confirmed → In Progress |
Changed in python2.7 (Ubuntu Raring): | |
importance: | Undecided → High |
Changed in python3.2 (Ubuntu Quantal): | |
assignee: | nobody → Barry Warsaw (barry) |
status: | New → In Progress |
Changed in python3.2 (Ubuntu Precise): | |
importance: | Undecided → High |
status: | Confirmed → In Progress |
Changed in python3.2 (Ubuntu Quantal): | |
importance: | Undecided → High |
Changed in python3.3 (Ubuntu Quantal): | |
assignee: | nobody → Barry Warsaw (barry) |
importance: | Undecided → High |
status: | New → In Progress |
Changed in python3.3 (Ubuntu Raring): | |
importance: | Undecided → High |
status: | Confirmed → In Progress |
Changed in python3.3 (Ubuntu Quantal): | |
assignee: | Barry Warsaw (barry) → nobody |
importance: | High → Undecided |
status: | In Progress → Invalid |
Hello Chris, or anyone else affected,
Accepted python2.7 into precise-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
Changed in python2.7 (Ubuntu Precise): | |
status: | In Progress → Fix Committed |
tags: | added: verification-needed |
Changed in python2.7 (Ubuntu Quantal): | |
status: | In Progress → Fix Committed |
Colin Watson (cjwatson) wrote : | #22 |
Hello Chris, or anyone else affected,
Accepted python2.7 into quantal-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
Changed in python2.7 (Ubuntu Raring): | |
status: | In Progress → Fix Committed |
Colin Watson (cjwatson) wrote : | #23 |
Hello Chris, or anyone else affected,
Accepted python2.7 into raring-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
Changed in python3.2 (Ubuntu Precise): | |
status: | In Progress → Fix Committed |
Colin Watson (cjwatson) wrote : | #24 |
Hello Chris, or anyone else affected,
Accepted python3.2 into precise-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
Changed in python3.2 (Ubuntu Quantal): | |
status: | In Progress → Fix Committed |
Colin Watson (cjwatson) wrote : | #25 |
Hello Chris, or anyone else affected,
Accepted python3.2 into quantal-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
Changed in python3.3 (Ubuntu Raring): | |
status: | In Progress → Fix Committed |
Colin Watson (cjwatson) wrote : | #26 |
Hello Chris, or anyone else affected,
Accepted python3.3 into raring-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
As a part of the Stable Release Updates quality process a search for Launchpad bug reports using the version of python2.7 from raring-proposed was performed and bug 1198439 was found. Please investigate this bug report to ensure that a regression will not be created by this SRU. In the event that this is not a regression remove the "verification-
tags: | added: verification-failed |
Barry Warsaw (barry) wrote : | #28 |
More information requested in LP: #1198439
Dick (oldcoot999) wrote : | #29 |
I don't have a clue what all the above chatter is all about.
What I do know is that Update Manager won't run -
I usually get several "internal system error" messages constantly popping up
so with all this happening 12.04 is almost useless.
I have had to switch to XP several times because 12.04 is so unstable.
Chris Weiss (cweiss) wrote : | #30 |
I've done a 12.10, and now 13.04 update since, the issue has not repeated.
Dick (oldcoot999) wrote : | #31 |
I would be glad to update to 12.10 and then 13.04 but my UPDATE MANAGER won't run. It can't find "dameon".
12.04 has been total trash!!!
tags: | removed: verification-failed |
Brian Murray (brian-murray) wrote : | #32 |
I went through a few crashes with EOFErrors on them on errors.ubuntu.com today and did not find any with the python packages from -proposed in their dependencies. I did this by checking the individual instances of all the "web_link"s below.
lsb.json: "function": "/usr/bin/
lsb.json- "package": "lsb-release",
lsb.json- "web_link": "https:/
--
lsb.json: "function": "/usr/bin/
lsb.json- "package": "lsb-release",
lsb.json- "web_link": "https:/
--
lsb.json: "function": "/usr/bin/
lsb.json- "package": "lsb-release",
lsb.json- "web_link": "https:/
--
ubuntuone-
ubuntuone-
ubuntuone-
--
unattended-
unattended-
unattended-
--
unattended-
unattended-
unattended-
--
unatten...
Changed in python3.2 (Ubuntu Raring): | |
status: | Invalid → Fix Released |
Changed in python3.2 (Ubuntu Saucy): | |
status: | Invalid → Fix Released |
Changed in python3.3 (Ubuntu Precise): | |
status: | Invalid → Fix Released |
Changed in python3.3 (Ubuntu Quantal): | |
status: | Invalid → Fix Released |
hebein (gunther-hebein) wrote : Re: [Bug 1058884] Re: Race condition in py_compile corrupts pyc files | #33 |
Ich bin bis einschliesslich 25.9. ausser Landes. Ich werde mich um Ihr Anliegen nach meiner Rückkehr so schnell als möglich kümmern.
Mit freundlichen Grüßen,
Gunther Hebein
Changed in python3.2 (Ubuntu Raring): | |
status: | Fix Released → Invalid |
Changed in python3.2 (Ubuntu Saucy): | |
status: | Fix Released → Invalid |
Changed in python3.3 (Ubuntu Precise): | |
status: | Fix Released → Invalid |
Changed in python3.3 (Ubuntu Quantal): | |
status: | Fix Released → Invalid |
Rolf Leggewie (r0lf) wrote : | #34 |
I'm willing to test this for precise but the bug lacks a test case!
Dimitri John Ledkov (xnox) wrote : | #35 |
It's racy, thus no reliable way to reproduce.
Rolf Leggewie (r0lf) wrote : | #36 |
quantal has seen the end of its life and is no longer receiving any updates. Marking the quantal task for this ticket as "Won't Fix".
Changed in python2.7 (Ubuntu Quantal): | |
status: | Fix Committed → Won't Fix |
Changed in python3.2 (Ubuntu Quantal): | |
status: | Fix Committed → Won't Fix |
Rolf Leggewie (r0lf) wrote : | #38 |
raring has seen the end of its life and is no longer receiving any updates. Marking the raring task for this ticket as "Won't Fix".
Changed in python2.7 (Ubuntu Raring): | |
status: | Fix Committed → Won't Fix |
Changed in python3.3 (Ubuntu Raring): | |
status: | Fix Committed → Won't Fix |
Ubuntu QA Website (ubuntuqa) wrote : | #40 |
This bug has been reported on the Ubuntu ISO testing tracker.
A list of all reports related to this bug can be found here:
http://
tags: | added: iso-testing |
I wonder if something is wrong with /usr/lib/ python3/ dist-packages/ DistUpgrade/ DistUpgradeVers ion.py on your system. The md5sum for it should be 5f632f7debefec8 464862c418ee0f3 ae. Could you verify the md5sum and if it is incorrect please reinstall the package python3- distupgrade? Thanks in advance.