Hello, I have found that once I call external processes (which generates files) from plenty of threads, sometimes file handles aren't closed and fail on opening or on unlinking of these files. It's very random problem and occurs only e.g. 0-3 times for 200 repeats. But I've tried Win32::Job and for it seems count of these problems increases. I don't know where's the problem:

1) antivirus realtime scan - I have no oportunity to disable it so I can't be sure this is not the reason. But if it's processed only in one thread I've not encountered this problem. 2) I had been searching internet if there's no problem with IO requests when comes from 2 threads in same time if one doesn't block the other, but found no solution.

Nice to hear I'm not the only one with such problems. Once it fails it fails always with Permission denied for opening same like for unlinking. File opening failed only when I tried Win32::Job(+file given by path not by file handle). Anyway both have problems on windows with unlinking.

I've tried example I posted on Windows XP, Windows 7 and Knoppix, Porteus Linux. Seems it works well only with Linux. Now the question is what's the reason? I'm thinking of: 1) bad threads implemetation of ActivePerl on Windows. 2) internal problem of Windows itself.

I wanted to try make the same for .Net but the Process class implementation in there doesn't offer saving to file directly (you have to save file on your own so at the end its saved outside the process) so even I find it works it proves nothing.

Hello, thank you for the post. I didn't know this tool. Seems interesting. I've to test it on my home PC, I don't have admin rights in here. I don't know why it's needed especially when ProcessExp is based on this tool and even accounts with limited rights can be used. Once I have time to test it at home I'll post result here.

Yep, Find menu works fine to solve common file locks but the problem is that the time period for which process locks file is very short. So the only way is to check it out in the code directly after opening/unlinking fails. For this purpose I think I can use the tool you gave me link to I guess.