in reply to Runing "regular" code with threaded perl

OK, lets look at other things that may have changed. The xspec application is an obvious one - does it fire off asynchronous tasks that might still be running after the "main" program completes? I know this is a horrible ugly hack, but try putting a sleep 4 after the system call before trying to open the file - this is for testing only, you would not want to leave the sleep there. It may expose a timing issue.

Also consider if you have the same version of xspec running on both machines, they may behave differently.

Replies are listed 'Best First'.
Re^2: Runing "regular" code with threaded perl
by kingskot (Sexton) on Jul 10, 2008 at 14:47 UTC
    OK, this was a helpful comment. Apparently, xspec is silently dying, but only sometimes. So, if I stepped through the debugger, or called xspec outside of my perl script, seemed to run fine, but this test with the sleep command shows me that it sometimes randomly dies (I can make the same call over and over again at the command line, and most of the time it works, but sometimes it fails). So, as suggested, my blaming of threaded perl was misplaced. Xpsec is a pretty standard and well-tested piece of astrophysical data analysis software, so figuring out why it's dying on my new system will be another (non-perl related) problem.

      I'll bet you anything that the problem you are having with Xpsec is what you suspected perl of doing.

      If it works most of the time but only sometimes fails then the most likely problem is that it has troubles with multiple threads and fast CPU's that might actually be able to complete their tasks so fat that the original programmer never expected this to be possible and thus didn't bother to check for this.

      One good option would be to find a mailing list for: Xspec and ask if others find the same issues, check to see if there is a new release etc.

      For the time being try to do the following in your code:

      until ( -e "${tmp}xsfit.dat" ) { bjmsys("xspec - ${tmp}.xcm", $v); } open(DAT, "${tmp}xsfit.dat") || die ("Could not open file!"); my @kT=<DAT>; close DAT;

      This will basically make sure that the file exists and only then continue if the file does not exist it will simply try to create is again, and again until the file is there. It is a very crude way of working but it will certainly do the trick.

      As long as Xspec does not take for ever and ever before it fails you should be saved until the Xspec problem is resolved.