pcall() considered harmful

Case number:845829-2003657
Opened by:LociOiling
Opened on:Wednesday, April 5, 2017 - 07:32
Last modified:Sunday, February 23, 2020 - 20:52

The pcall function is built in to Lua. It's intended to catch errors. A Foldit recipe can use pcall to trap errors that would otherwise terminate the recipe.

The following Lua code now crashes the client:

for ii = 1, 9999 do
   print ( "test # " .. ii )
   pcall ( selection.SelectRange, -1, 9999 )

This command does not crash the client:

selection.SelectRange ( -1, 9999 )

Also, this version does not cause a crash:

for ii = 1, 9999 do
   print ( "test # " .. ii )
   pcall ( selection.SelectRange, 1, 10 )

So it seems to have something to do with a Foldit function, called via pcall, that throws an error.

This is somewhat new behavior. I have test script that checks around 100 boundary conditions. I hadn't run the script since September 2015, but it was working at the time. Now it crashes somewhat consistently after about 75 pcalls, not all of which are expected to produce an error.

The loop example above causes a crash much more quickly, although it's hard to tell exactly how many tests it completes.

Release 20170320-3ecbad1b35-win_x86

(Wed, 04/05/2017 - 07:32  |  4 comments)

Joined: 12/27/2012
Groups: Beta Folders

Log file attached. No debug.txt is generated.

Event log error:

Log Name: Application
Source: Application Error
Date: 4/5/2017 1:12:24 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: XXXXXXXX
Faulting application name: Foldit.exe, version:, time stamp: 0x546d537b
Faulting module name: game_library.dll, version:, time stamp: 0x58d0ce35
Exception code: 0xc0000005
Fault offset: 0x009ba8ce
Faulting process id: 0x716ac
Faulting application start time: 0x01d2ae380ca351fd
Faulting application path: C:\Foldit\Foldit\Foldit.exe
Faulting module path: C:\Foldit\Foldit\cmp-binary-723ed6cab4ebe4776d6b41b7c6f68bf6\game_library.dll
Report Id: 023790ad-5c7f-42dc-907f-c0dc0d21c856
Faulting package full name:
Faulting package-relative application ID:

Joined: 12/27/2012
Groups: Beta Folders

Still a problem in 20180725-d14dae34c3-win_x86-devprev.

The code:

for ii = 1, 9999 do
   print ( "test # " .. ii )
   pcall ( selection.SelectRange, -1, 9999 )

The most recent test ends with just "UNHANDLED EXCEPTION" as the last line in log.txt, no traceback info.

Joined: 12/27/2012
Groups: Beta Folders

Good news, this problem is fixed in 20191029-32048a6a12-win_x86-devprev. Now 9,999 pcall errors are fine. Closing....

Joined: 12/27/2012
Groups: Beta Folders
Status: Open » Closed

Closing again.....


Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons