njh / redstore

RedStore is a lightweight RDF triplestore written in C using the Redland library.
https://www.aelius.com/njh/redstore/
GNU General Public License v3.0
62 stars 6 forks source link

recommended way to stop redstore on command line? #42

Closed ramorrismorris closed 12 years ago

ramorrismorris commented 12 years ago

In ubuntu linix 11.04 and 11.10, catchable kill signals seem to cause a segmentation fault.

What is the recommended way to stop a running redstore?

RedStore/0.5.4 librdf/1.0.15 raptor/2.0.6 rasqal/0.9.28

njh commented 12 years ago

The recommended way to stop RedStore is to send it a INT or a TERM signal. It catches both of these and should then shut down cleanly.

Could you send me a stack trace from gdb to see where it is going wrong?

ramorrismorris commented 12 years ago

This is the behavior from the shell when the redstore is sent SIGINT from another shell. It's conceivable that the segfault announcement is bogus...

ram@milne:/usr/local/bin/redstore -s hashes -t "hash-type='bdb',dir='.'" redstore.db [INFO] Mon Dec 19 16:21:14 2011 Storage name: redstore.db [INFO] Mon Dec 19 16:21:14 2011 Storage type: hashes [INFO] Mon Dec 19 16:21:14 2011 Storage options: write='yes', hash-type='bdb', dir='.', contexts='yes' [INFO] Mon Dec 19 16:21:14 2011 Starting HTTP server on port 8080 [INFO] Mon Dec 19 16:21:51 2011 Got termination signal. Segmentation fault

As to gdb:

The last time I used gdb was around 1989, so I hope this is right and helpful. At the point the gdb claims to have received SIGTERM I had issued kill SIGINT 3907 from another shell, to the child redstore process 3907 of the gdb.

ram@milne:gdb --args /usr/local/bin/redstore -s hashes -t "hash-type='bdb',dir='.'" redstore.db GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-linux-gnu". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /usr/local/bin/redstore...done. (gdb) run Starting program: /usr/local/bin/redstore -s hashes -t hash-type=\'bdb\',dir=\'.\' redstore.db [Thread debugging using libthread_db enabled] [INFO] Mon Dec 19 16:08:32 2011 Storage name: redstore.db [INFO] Mon Dec 19 16:08:32 2011 Storage type: hashes [INFO] Mon Dec 19 16:08:32 2011 Storage options: write='yes', hash-type='bdb', dir='.', contexts='yes' [INFO] Mon Dec 19 16:08:32 2011 Starting HTTP server on port 8080

Program received signal SIGTERM, Terminated. 0xb7fe1424 in __kernel_vsyscall () (gdb) backtrace

0 0xb7fe1424 in __kernel_vsyscall ()

1 0xb7b7164d in select () from /lib/i386-linux-gnu/libc.so.6

2 0x08053db2 in redhttp_server_run (server=0x8123f38) at server.c:173

3 0x0804f948 in main (argc=, argv=)

at redstore.c:418

(gdb) continue Continuing. [INFO] Mon Dec 19 16:09:40 2011 Got termination signal.

Program received signal SIGSEGV, Segmentation fault. 0xdbdbdbdb in ?? () (gdb) backtrace

0 0xdbdbdbdb in ?? ()

1 0x08070f43 in librdf_hash_bdb_close (context=0x8125988)

at rdf_hash_bdb.c:297

2 0x0806c94a in librdf_storage_hashes_close (storage=0x81259c8)

at rdf_storage_hashes.c:576

3 0x0805babb in librdf_model_storage_destroy (model=0x8125290)

at rdf_model_storage.c:136

4 0x08058d91 in librdf_free_model (model=0x8125290) at rdf_model.c:422

5 0x0804f830 in main (argc=, argv=)

at redstore.c:432

(gdb)

ramorrismorris commented 12 years ago

FWIW, although the [INFO] output of redstore would normally be reassuring, the segfault, if real, makes one worry whether the database is closed properly in all possible scenarios.

njh commented 12 years ago

Problem re-produced and fixed in 6d242ab67f697a3d31e0fc5aae4f6d9c12c7a880