gregorbj / Archive-VisionEval

VisionEval Model System and Framework (formerly RSPM Framework)
Apache License 2.0
28 stars 19 forks source link

VEGUI - Model runs sometimes crash when initiated in VEGUI #211

Closed landisrm closed 5 years ago

landisrm commented 5 years ago

Model runs sometimes crash when they are initiated from VEGUI. The problem seems to be more common with VERSPM (described here) but also happens with VERPAT. Running either model outside of VEGUI doesn't produce the error.

Here is part of the stack trace from the console:

[1] "38: 2018-11-07 15:34:13: Calling readModelState" [1] "39: 2018-11-07 15:34:13: getScriptOutput entered" [1] "40: 2018-11-07 15:34:14: Model output is captured in C:\Users\MATT~1.LAN\AppData\Local\Temp\RtmpW2scbZ\VEGUI_source_capture52c551220b0.txt" [1] "41: 2018-11-07 15:34:14: Working directory is C:/Users/matt.landis/Git/VisionEval/sources/models/VERSPM/Test1" [1] "42: 2018-11-07 15:34:14: Calling source on C:\Users\matt.landis\Git\VisionEval\sources\models\VERSPM\Test1\run_model.R" [1] "2018-11-07 15:34:21: ERROR processRunningTasks: 'CAPTURED_SOURCE' returned an error: Error in gzfile(file, \"wb\"): cannot open the connection\n" Warning: Error in gzfile: cannot open the connection 51: Anonymous

The call to gzfile suggests that it may be having a problem with reading from or writing to an *.rda file.

And the tail of the log file is:

2018-11-07 15:34:19 : Module 'AdjustVehicleOwnership' will overwrite dataset 'Vehicles' in table 'Household'. 2018-11-07 15:34:19 : Module 'AdjustVehicleOwnership' will overwrite dataset 'NumLtTrk' in table 'Household'. 2018-11-07 15:34:19 : Module 'AdjustVehicleOwnership' will overwrite dataset 'NumAuto' in table 'Household'. 2018-11-07 15:34:19 : Model run simulation completed without identifying any errors. 2018-11-07 15:34:19 : Warning regarding input values for HvyTrk inputs for Marea RVMPO. The sum of the values do not add up to 1 but are off by 1% or less so they have been adjusted to add up to 1.

The log file ends with output from simDataTransactions, called in visioneval.R line 323. But there may be calls after that during "Check and process module inputs" in visioneval.R lines 330:350.

This is hard to trace back because in VEGUI, the model is running as a future using startAsyncTask and thus is relatively inaccessible for examination and doesn't produce a real traceback.

Additional writeLog statements may help identify the location, but can cause additional problems. During attempts to use writeLog to identify the error location, a slightly different error was thrown: "Error in file(LogFile, \"a\"): cannot open the connection", most likely from visioneval::writeLog, potentially due to a collision between the model process trying to write to it, and the VEGUI process trying to read from it.

landisrm commented 5 years ago

Confirming that this appears to be a problem only on Windows. I have run both VERPAT and VERSPM via VEGUI several times on a MacBook Pro running Sierra (10.12.6) without this error appearing.