Coredump caused by function SERVERreconnectWithoutAlias() and its verifies fix

Sjoerd Mullender sjoerd at monetdb.org
Tue Mar 12 09:26:47 CET 2013


Thanks for finding this.  I've fixed the code.

On 2013-03-11 22:41, Fang Cao wrote:
> Hi,
> 
> Today when I try to use mapi.connect() and mapi.reconnect() with
> mserver5, I found such crash when I tried to :
> 
> fang at fang-ThinkCentre-M91p:~/Work/DB-Farm$ mserver5
> --dbpath=/home/fang/Work/DB-Farm
> # MonetDB 5 server v11.15.1 "Feb2013"
> # Serving database 'DB-Farm', using 8 threads
> # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs
> dynamically linked
> # Found 3.692 GiB available main-memory.
> # Copyright (c) 1993-July 2008 CWI.
> # Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved
> # Visit http://www.monetdb.org/ for further information
> # Listening for connection requests on mapi:monetdb://127.0.0.1:50000/
> <http://127.0.0.1:50000/>
> # MonetDB/GIS module loaded
> # MonetDB/JAQL module loaded
> # MonetDB/SQL module loaded
>>mid:=mapi.reconnect("localhost",50000,"monetdb","monetdb","mal");
> Segmentation fault (core dumped)
> 
> The root cause is located at:
> 
> SERVERreconnectWithoutAlias(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
> InstrPtr pci) {
>         int *key =(int*) getArgReference(stk,pci,0);
>         str *host = (str*) getArgReference(stk,pci,1);
>         int *port = (int*) getArgReference(stk,pci,2);
>         str *username = (str*) getArgReference(stk,pci,4);  ===>>should be 3
>         str *password = (str*) getArgReference(stk,pci,5); ===>>should be 4
>         str *lang = (str*) getArgReference(stk,pci,6); ===>>should be 5
> 
> Since we only transfer 5 input parameters, so for the last one “lang”,
> of course we will coredump the program when try to check 6th.
> 
> After the modification, everything is fine now, for both mapi.connect()
> and mapi.reconnect()
> 
> The reason why this issue is introduced:
> pattern reconnect(host:str, port:int, usr:str, passwd:str,lang:str):int
> address SERVERreconnectWithoutAlias
> comment "Re-establish connection with a remote mserver.";
> 
> pattern reconnect(host:str, port:int, db_alias:str, usr:str,
> passwd:str,lang:str):int
> address SERVERreconnectAlias
> comment "Re-establish connection with a remote mserver.";
> 
> So when to implement SERVERreconnectWithoutAlias(), seems following the
> style of SERVERreconnectAlias(). The latter one has 6 inputs, but the
> first one has only 5 inputs. So un-needed db_alias was removed, but
> forgot to adjust the sequence number.
> 
> Thanks,
> 
> Fang
> 
> 
> 
> _______________________________________________
> developers-list mailing list
> developers-list at monetdb.org
> http://mail.monetdb.org/mailman/listinfo/developers-list
> 


-- 
Sjoerd Mullender

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 371 bytes
Desc: OpenPGP digital signature
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20130312/16e612fd/attachment.sig>


More information about the developers-list mailing list