deadlock within screen-scraper 4.0 when executing small scripts
Hello,
We've been facing with a deadlock issue within screen-scraper 4.0 enterprise edition. Our environment is a Linux 2.6.27.7-53.fc9.i686 (Fedora Core 9) running on a x86 single CPU machine with low average load (only screen scraper is running on the box). We have scheduled (using cron) different SS sessions to run on a daily basis. We've noticed that some sessions are stalling at random times. After some debugging, we've realized that we're dealing with a deadlock issue within ScriptContext class which is responsible for executing SS scripts. The faulty algorithm is the following (within process() method):
1. Create new ScriptRunner thread (that actually interprets and runs the script) and trigger its start
2. Check for its successful start
3. Wait for the ScriptRunner instance to end using a shared lock for synchronization
Imagine that there's an OS process switch between step 2 and 3 and the thread that was executing the script fully ends its job. When the main thread (executing ScriptContext) reaches step 3, it will wait forever on the lock because there won't be any lock.notify() executed (ScriptRunner instance has already finished executing and performed the lock.notify() while the ScriptRunner process wasn't waiting on the lock).
A workaround (besides fixing the code) would be to add a Thread.sleep() at the end of each script that might be executed very fast (eg: script that stores some constants in the SS session).
Regards
Hi, We actually made a fix in
Hi,
We actually made a fix in one of the more recent alpha versions that I believe will correct this. Would you mind upgrading to the latest version and giving it a try? Here's a FAQ in case you run into trouble upgrading:
http://community.screen-scraper.com/faq#80n867
Thanks,
Todd
Thanks, the problem seems to
Thanks, the problem seems to be fixed in the latest alpha version.