Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not panic when shared-memory is full, raise Tcl error instead #8

Open
bovine opened this issue Jan 6, 2011 · 3 comments
Open

Do not panic when shared-memory is full, raise Tcl error instead #8

bovine opened this issue Jan 6, 2011 · 3 comments

Comments

@bovine
Copy link
Member

bovine commented Jan 6, 2011

When shared-memory becomes full and a new record is added, then the code currently calls the xxx_shmpanic() handler, which invokes panic() and aborts the process.

The code should be changed to raise a Tcl error that the user can "catch" and handle appropriately, perhaps by deleting some rows from the table.

@bovine
Copy link
Member Author

bovine commented Jan 6, 2011

There appears to be an undocumented "panic" option that can be specified to the "create" method (which sets ctable->share_panic), however it does not seem to be honored in all of the places it should be. Repeatedly calling "store" will still trigger a panic.

@resuna
Copy link
Member

resuna commented Jan 6, 2011

This is another hard problem we ran into during development.

The problem is that Speedtables memory management is based on Tcl's memory management, and Tcl assumes that memory allocations always succeed. Shared memory allocations can occur in places where there's no framework in Speedtables itself for propogating a failure back to a place where it can be handled.

@bovine
Copy link
Member Author

bovine commented Jan 6, 2011

Actually, it looks the argument parsing for the "panic" option was just bad. It was misinterpreting the return value from strcmp(). I committed a change to fix that obvious error, which allows me to now catch the failure during "store".

[master fc7589d] properly parse the "panic" option to "create". github issue 8.
3 files changed, 6 insertions(+), 1 deletions(-)

Leaving this issue open for now....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants