setting structure type "M" on any valid segment crashes client

Case number:699969-2000922
Topic:General
Opened by:LociOiling
Status:Closed
Type:Bug
Opened on:Monday, July 6, 2015 - 20:56
Last modified:Tuesday, September 8, 2015 - 19:55

This is a kind of corollary to http://fold.it/portal/node/2000613

A recipe that sets secondary structure type "M" on any valid segment crashes the client on Windows.

To recreate this issue:

1. Open any puzzle, for example 1107

2. Open the recipe editor, click "New (ScriptV2)"

3. Paste this recipe

 structure.SetSecondaryStructure ( 15, "M" )

4. Click "Run"

5. The client crashes.

6. An unhandled exception appears in log.txt

7. debug.txt is not created or updated

This error is specific to type "M", other totally invalid codes such as "Q" or "!" do not produce a crash.

Also, segment numbers such as -17 and 9999 are quietly tolerated.

Even absurd efforts like

 structure.SetSecondaryStructure ( "fred", 32 )

don't cause a crash.

An invalid segment number does offer protection, so

 structure.SetSecondaryStructure ( 9999, "M" )

does not cause a crash.

In general, it seems like having structure.SetSecondaryStructure and similar functions return true on success and false on failure (or inaction) would be beneficial.

(Mon, 07/06/2015 - 20:56  |  5 comments)


LociOiling's picture
User offline. Last seen 49 min 17 sec ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

Taking things to their logical extreme here.

The following recipe produces a crash on puzzles with a ligand:

 

for ii = structure.GetCount (), 1, -1 do
  structure.SetSecondaryStructure ( ii, structure.GetSecondaryStructure ( ii ) ) 
end

The ligand can be a real ligand or one produced by the auto structures bug.

bkoep's picture
User offline. Last seen 2 hours 3 min ago. Offline
Joined: 11/15/2012
Groups: None

Thanks for the feedback, LociOiling!

This particular problem should be easy enough to fix, but there seem to be a host of problems involving the MOLECULE secondary structure designation (type "M"). We're looking into it!

brow42's picture
User offline. Last seen 13 hours 45 min ago. Offline
Joined: 09/19/2011
Groups: None

Don't forget that some puzzles were configured with _ secondary structure as well. These should be mapped to 'M' for us if it happens again. Nobody expects a _.

LociOiling's picture
User offline. Last seen 49 min 17 sec ago. Offline
Joined: 12/27/2012
Groups: Beta Folders

A little clarification on the bad arguments, and an additional nit.

When I said most bad arguments to structure.SetSecondaryStructure are "quietly tolerated", I meant they don't crash the client. They do terminate the recipe with an error message. Only the structure type "M" crashes the client.

So a determined programmer can use the pcall function to simulate a try-catch block. See http://foldit.wikia.com/wiki/Using_pcall_to_trap_Lua_errors for more information on that.

The nit is that the error message for structure.SetSecondaryStructure always says argument 1 is to blame.

For example, the recipe:

structure.SetSecondaryStructure ( 15, "_" )

produces a message saying "bad argument #1":

ERROR: [string "structure.SetSecondaryStructure ( 15, "_" )"]:1: bad argument #1 to 'SetSecondaryStructure' (invalid argument)

even though it's argument 2 that's invalid.

The recipe

structure.SetSecondaryStructure ( 15000, "H" )

produces an error message that correctly says "bad argument #1":

ERROR: [string "structure.SetSecondaryStructure ( 15000, "H..."]:1: bad argument #1 to 'SetSecondaryStructure' (segment index out of bounds)

This is a bit confusing. I'm guessing that maybe someone forgot to change the argument number when creating the message for the second argument.

LociOiling's picture
User offline. Last seen 49 min 17 sec ago. Offline
Joined: 12/27/2012
Groups: Beta Folders
Status: Open » Closed

As noted in http://fold.it/portal/node/2000613, types "m" and "M" no longer crash the client.

The valid secondary structure are now 'e', 'h', 'l', 'm', 'E', 'H', 'L', and 'M'. The codes 'm' and 'M' don't seem to have any effect on a non-ligand puzzle. Other codes still terminate the recipe, but don't crash the client.

This fix should allow a recipe to save and restore the secondary structure segment-by-segment without worrying about ligand puzzles.

The second issue reported on this feedback, the incorrect "bad argument #1" is still an issue. Nevertheless, I'm marking this feedback as closed.

Sitemap

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