resetConfig: Flashing Default Script: FAILED

General Q&A specific to RaceCapture/Pro. For app related questions post in the RaceCapture App forum. also see the <a href="http://www.autosportlabs.net/RaceCapture">RaceCapture Information Page</a>

Moderators: JeffC, rdoherty, stieg, brentp

Post Reply
eacmen
Posts: 15
Joined: Fri Dec 30, 2016 7:39 am

resetConfig: Flashing Default Script: FAILED

Post by eacmen »

This is more of a bug report than a question expecting an answer.

After several iterations of modifying lua scripts I will eventually get the following error:

lua: Failed to allocate memory for script buffer.

When this error pops up the RCP gets very unstable and has to be hard-reset. Usually I would expect this error would happen with a lua script that is too long. However, even with lua scripts that I *know* have worked before and also tried examples from the wiki.

So, naturally, I went to do a resetConfig over the TTY (which usually fixes any bad state with RCP). And I get the following error when doing resetConfig:

Code: Select all

0 [email protected] ~$ sudo miniterm.py /dev/ttyACM0 115200
--- Miniterm on /dev/ttyACM0  115200,8,N,1 ---
--- Quit&#58; Ctrl+&#93; | Menu&#58; Ctrl+T | Help&#58; Ctrl+T followed by Ctrl+H ---



=============================================
Welcome to RaceCapture/Pro MK3 version 2.12.0
=============================================

Available Commands&#58;

resetConfig   &#58; Resets All configuration Data to factory default Usage&#58; resetConfig
testSD        &#58; Test Write to SD card. Usage&#58; testSD <lineWrites> <periodicFlush> <quietMode>
startTerminal &#58; Starts a debugging terminal session on the specified port. Usage&#58; startTerminal <port> <baud> &#91;echo 1|0&#93;
setLogLevel   &#58; Sets the log level Usage&#58; setLogLevel <level>
logGpsData    &#58; Enables logging of raw GPS data from the GPS Mouse Usage&#58; logGpsData <1|0>
viewLog       &#58; Prints out logging messages to the terminal as they happen Usage&#58; viewLog
setSerialLog  &#58; Enables/disables logging of  serial device for debug purposes Usage&#58; setSerialLog <port> <0|1>
flashConfig   &#58; Flashes the NVRAM with the current configuration of the LoggerConfig Usage&#58; flashConfig
showTasks     &#58; Show status of running tasks Usage&#58; showTasks
version       &#58; Gets the version numbers Usage&#58; version
showStats     &#58; Info on system statistics. Usage&#58; showStats
sysReset      &#58; Reset the system Usage&#58; sysReset &#91;bootloader 0|1&#93;
lua           &#58; Enter the lua script interpreter. Usage&#58; lua
reloadScript  &#58; Reloads the current script. Usage&#58; reloadScript
RaceCapture/Pro MK3 > resetConfig

Flashing Default Logger Config&#58; PASS
Flashing Default Script&#58; FAILED       <<<<< UH OH?!?
Flashing Default Tracks&#58; PASS
I try this several times with the same result. And the lua script persists.

Now when I go in through the RCP App interface and delete the script, then do a resetConfig it works.

I guess my ultimate question is now that the interface supports CAN Mapping, is there any reason to be using the E46 Lua script on the wiki? Is the built-in CAN mapping feature going to be more stable than the lua script method?

[/code]

brentp
Site Admin
Posts: 5956
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

The built-in CAN mapping is designed to be the primary CAN mapping tool for RaceCapture/Pro /Apex - and the Lua scripting is still there to cover the unusual mapping scenarios that the direct CAN mapping cannot handle. A combination of both can be used.

Both approaches are described here: https://wiki.autosportlabs.com/CAN_Bus_Integration

The Lua scripting runtime is designed in such a way to prevent compromising system stability when it runs out of memory. Do you have an example of a script that reproduces this problem? We'd like to characterize the issue if possible.

Thanks!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Post by wcorredor »

Brent
I found the original post by eacmen.
This is exactly the same problem I have.
Once you hit the limit it becomes unstable and difficult to recover, even with small scripts you get the "lua: Failed to allocate memory for script buffer."

brentp
Site Admin
Posts: 5956
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Right. This is a side effect of increasing the memory limit by 20% in the 2.13.0 firmware. This problem does not happen in the 2.12.x firmware.

We will work to make it easier to recover from this in an upcoming firmware. In the meantime, take extra care to not hit the memory limit.

Thanks,
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Post by wcorredor »

OK. I will be counting bytes next time.

In the meantime, can you tell me how to reset that memory?

I can't load even shorter scripts that worked before.

brentp
Site Admin
Posts: 5956
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Try temporarily downgrading to 2.12.0 firmware to see if you can reset the configuration.

wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Post by wcorredor »

This is what I did and it worked:

saved configuration not to loose analog sensors.
Downgraded to 2.12.0
flashed an empty script
resetConfig (via Putty)

upgraded to 2.13.5
The scripts worked again.

Not sure which of the steps really erased the configuration, but it is working again.

brentp
Site Admin
Posts: 5956
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Thanks for the update. We'll work to get flashing of the default script working reliably with 2.13.6 or 2.14.0.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

wcorredor
Posts: 49
Joined: Thu Oct 27, 2016 6:29 pm

Post by wcorredor »

Was this issue addressed in the new beta version?
Should I try the longer script or not yet?
I don't want to block it again, it is realy hard to recuperate.

brentp
Site Admin
Posts: 5956
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

No, the beta version strictly has the long-promised feature of enabling pit-to car alerts. We'll address this in the production non-beta release.

Thanks!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply