Ok, did a full strace and found some interesting stuff.
Full strace is on
http://sinas.rename-it.nl/~tobias/output2 (watch out, 1.1mb plaintext). Ctrl+f for 'fleet foxes' since this is the file i added and where the magic stuff happens. I'll paste some excerpts.
- Code: Select all
Worker 4653 receives something about some 'fleet foxes'. Work to do!
4653 recv(8, "</file>\n<file subject=\"Fleet Fox"..., 8192, 0) = 8192
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)", 0xb553c95c) = -1 ENOENT (No such file or directory)
There is no directory yet.
4653 stat64("/mnt/sharedoos/news/incomplete", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)", 0xb553c46c) = -1 ENOENT (No such file or directory)
4653 mkdir("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)", 0777) = 0
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", 0xb553ccdc) = -1 ENOENT (No such file or directory)
4653 mkdir("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", 0777 <unfinished ...>
4653 <... mkdir resumed> ) = 0
So now we have the dirstructure in place.
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
check the ADMIN dir...
4653 open("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__/SABnzbd_nzf_JkQmJX", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE|O_NOFOLLOW, 0600) = 12
and create an admin file. It is created as filehandle 12.
4653 fcntl64(12, F_GETFD) = 0
4653 fcntl64(12, F_SETFD, FD_CLOEXEC) = 0
4653 close(12) = 0
Do stuff, close it. Done!
but then...
4653 open("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__/SABnzbd_nzf_JkQmJX", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory)
?! where did the file go? Why is it reading it as 0666 now?
The worker becomes confused enough to kill itself, so it reinits.
4653 open("/root/oldsab/SABnzbd-0.6.14/sabnzbd/__init__.py", O_RDONLY|O_LARGEFILE) = 12
It checks if the directory is still there, and gets directory contents twice. (why twice? No clue.)
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", {st_mode=S_IFDIR|0700, st_size=0, ...}) = 0
4653 open("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 12
4653 getdents64(12, /* 3 entries */, 32768) = 88
4653 getdents64(12, /* 0 entries */, 32768) = 0
4653 close(12) = 0
4653 open("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 12
4653 getdents64(12, <unfinished ...>
4653 <... getdents64 resumed> /* 3 entries */, 32768) = 88
4653 getdents64(12, /* 0 entries */, 32768) = 0
4653 close(12) = 0
Then something interesting happens.
4653 stat64("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__/SABnzbd_nzf_JkQmJX", {st_mode=S_IFREG|0700, st_size=0, ...}) = 0
Obviously the file still exists (stat returns 0, which is OK) and it was found by the above open(). Why did it not find it before?! Timing?
4653 unlink("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__/SABnzbd_nzf_JkQmJX") = 0
Damagecontrol; remove the adminfile and all dirs.
4653 rmdir("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)/__ADMIN__") = 0
4653 stat64("/mnt/sharedoos/news/incomplete", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
4653 rmdir("/mnt/sharedoos/news/incomplete/Fleet Foxes -- Helplessness Blues (2011)") = 0
And we're clear.
I can find in the code where the second 'write' happens that errors here (in __init__.py, near line 772, but I cannot find where the initial write happens. Can somebody point me there? Perhaps all this is just a big timing problem for Samba. Or something else.
Which dev now knows 'ah, i see whats going on here' ?
