more useful options | |
PerlMonks |
[SOLVED] Strange IO + concurrency issueby vsespb (Chaplain) |
on Sep 28, 2013 at 15:26 UTC ( [id://1056143]=perlquestion: print w/replies, xml ) | Need Help?? |
vsespb has asked for the wisdom of the Perl Monks concerning the following question: outputs the following (tested on Linux, perl 5.10 and 5.18): -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24171_somefile1.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24171_somefile2.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24171_somefile3.tmp -rw-r--r-- 1 vse vse 32288768 2013-09-28 19:10 c_24171_somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24171_somefile5.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24172_somefile1.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24172_somefile2.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24172_somefile3.tmp -rw-r--r-- 1 vse vse 28540928 2013-09-28 19:10 c_24172_somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24172_somefile5.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24173_somefile1.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24173_somefile2.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24173_somefile3.tmp -rw-r--r-- 1 vse vse 21893120 2013-09-28 19:10 c_24173_somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24173_somefile5.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24174_somefile1.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24174_somefile2.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24174_somefile3.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24174_somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24174_somefile5.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24175_somefile1.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24175_somefile2.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24175_somefile3.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 c_24175_somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 c_24175_somefile5.tmp -rw-r--r-- 1 vse vse 0 2013-09-28 19:10 lock.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 somefile1.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 somefile2.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 somefile3.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 somefile4.tmp -rw-r--r-- 1 vse vse 40000000 2013-09-28 19:10 somefile5.tmpSo: 1. file size of some c_* files is less than 40000000, however this should not happen, because of line:
2. If I replace copy() with x_copy() call, the following line reports error (or eof):
3. there is locking via getlock() where it should be. 4. all files are closed, so buffering is not an issue? 5. this code works, with 1 child process, but fails on concurrent processes. Question: I assume, after file is closed, it's written to filesystem Am I right? If yes, then I have to suspect some bug in perl, please help me find where I am wrong. Initially I had this issue in a bigger program, but now I simplified it to this proof-of-concept code which reproduce issue. UPD: Solved: Re^2: Strange IO + concurrency issue
Back to
Seekers of Perl Wisdom
|
|