Martin Kersten a écrit :
pthread_create(&sqlthread, NULL, start_sql_server, (void *) server);
I would start by being more defensive. What is the return value of pthread_create? did it work?
That is something I'd like to know. My problem is that the start_sql_server symbol is not exported from the shared library libembeddedsql5.so. This code is in fact what is available in the libembeddedsql5.so provided by the Debian package. The exported symbol is monetdb_sql:
yziquel@seldon:/usr/lib$ nm -D libembeddedsql5.so | grep monetdb_sql 0000000000017d70 T monetdb_sql
My issue is that start_sql_server is not exported...
mapi_start_talking(mid);
This leads to a potential race condition, when this function is called there is no proof that the server thread has actually be started. This means that all kind of variables will not have been initialized and which easily generates a segfault.
If there is a race condition in monetdb_sql and embedded_sql in the libembeddedsql5.so library, then this is likely a bug...
return mid; }
For the record, the full list of options used to start the server is the following:
# s;; - : MonetDB5.Opt.opt list = [{kind = Builtin; name = "gdk_arch"; value = "64bitx86_64-pc-linux-gnu"}; {kind = Builtin; name = "gdk_version"; value = "1.34.2"}; {kind = Builtin; name = "prefix"; value = "/usr"}; {kind = Builtin; name = "exec_prefix"; value = "${prefix}"}; {kind = Builtin; name = "gdk_dbname"; value = "tst"}; {kind = Builtin; name = "gdk_dbfarm"; value = "/var/MonetDB"}; {kind = Builtin; name = "gdk_debug"; value = "8"}; {kind = Builtin; name = "gdk_alloc_map"; value = "yes"}; {kind = Builtin; name = "gdk_vmtrim"; value = "yes"}; {kind = Builtin; name = "monet_admin"; value = "adm"}; {kind = Builtin; name = "monet_prompt"; value = ">"}; {kind = Builtin; name = "monet_welcome"; value = "yes"}; {kind = Builtin; name = "monet_mod_path"; value = "${exec_prefix}/lib/MonetDB"}; {kind = Builtin; name = "monet_daemon"; value = "yes"}; {kind = Builtin; name = "host"; value = "localhost"}; {kind = Builtin; name = "mapi_port"; value = "50000"}; {kind = Builtin; name = "mapi_noheaders"; value = "no"}; {kind = Builtin; name = "mapi_debug"; value = "0"}; {kind = Builtin; name = "mapi_clients"; value = "2"}; {kind = Builtin; name = "sql_debug"; value = "0"}; {kind = Builtin; name = "standoff_ns"; value = "http://monetdb.cwi.nl/standoff"}; {kind = Builtin; name = "standoff_start"; value = "start"}; {kind = Builtin; name = "standoff_end"; value = "end"}; {kind = Config; name = "prefix"; value = "/usr"}; {kind = Config; name = "config"; value = "/etc/monetdb5.conf"}; {kind = Config; name = "monet_mod_path"; value = "${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin"}; {kind = Config; name = "prefix"; value = "/usr"}; {kind = Config; name = "exec_prefix"; value = "${prefix}"}; {kind = Config; name = "gdk_dbfarm"; value = "/var/MonetDB5/dbfarm"}; {kind = Config; name = "gdk_dbname"; value = "demo"}; {kind = Config; name = "gdk_alloc_map"; value = "no"}; {kind = Config; name = "gdk_embedded"; value = "no"}; {kind = Config; name = "gdk_debug"; value = "0"}; {kind = Config; name = "monet_mod_path"; value = "${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin"}; {kind = Config; name = "monet_daemon"; value = "no"}; {kind = Config; name = "monet_welcome"; value = "yes"}; {kind = Config; name = "mero_msglog"; value = "/var/log/MonetDB/merovingian.log"}; {kind = Config; name = "mero_errlog"; value = "/var/log/MonetDB/merovingian.log"}; {kind = Config; name = "mero_pidfile"; value = "/var/run/MonetDB/merovingian.pid"}; {kind = Config; name = "mero_controlport"; value = "50001"}; {kind = Config; name = "mal_init"; value = "${exec_prefix}/lib/MonetDB5/mal_init.mal"}; {kind = Config; name = "mal_listing"; value = "2"}; {kind = Config; name = "mapi_port"; value = "50000"}; {kind = Config; name = "mapi_autosense"; value = "false"}; {kind = Config; name = "mapi_open"; value = "false"}; {kind = Config; name = "sql_optimizer"; value = "default_pipe"}; {kind = Config; name = "default_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "replication_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,garbageCollector,dataflow,history,replication,multiplex"}; {kind = Config; name = "accumulator_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,accumulators,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "recycler_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,deadcode,recycle,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "cracker_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,selcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "datacell_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,datacell,deadcode,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "octopus_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,mitosis,aliases,mergetable,deadcode,constants,commonTerms,joinPath,octopus,deadcode,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Config; name = "mitosis_pipe"; value = "inline,remap,evaluate,costModel,coercions,emptySet,mitosis,aliases,mergetable,deadcode,constants,commonTerms,joinPath,reorder,deadcode,reduce,garbageCollector,dataflow,history,multiplex"}; {kind = Command_line; name = "gdk_dbfarm"; value = "/home/yziquel/sandbox/monetdb5"}; {kind = Command_line; name = "gdk_dbname"; value = "testdb"}]
Please tell me if there is something obviously wrong here. I'll try to check if the thread started successfully. -- Guillaume Yziquel http://yziquel.homelinux.org/