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

Segmentation fault, Ubuntu 18 and mysqlclient ver 21 #227

Open
cyberience opened this issue Nov 26, 2019 · 1 comment
Open

Segmentation fault, Ubuntu 18 and mysqlclient ver 21 #227

cyberience opened this issue Nov 26, 2019 · 1 comment

Comments

@cyberience
Copy link

I add this issue here, because, though it looks like a dependancy problem, others may struggle with this, once we find a work around ill update this issue, if any one else has insight, feel free to recoment.
Situation: Using Ubuntu 18
Status: Uodate packages and libraries on 15th Novemeber
Result: Match engine fails to run. (Compile ok)
Evidence:
[2019-11-26 11:42:56.735344] [840] [fatal]ut_misc.c:83(process_keepalive): process: 3171, name: matchengine terminated by signal: 'Segmentation fault'
[2019-11-26 11:42:57.737984] [3173] [fatal]ut_signal.c:90(signal_handler): [3173]signal: 11 (SIGSEGV) received, core dumping
==========backtrace=start==========
0 /var/exchdb/exchange/app/matchengine() [0x46d910]
1 /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890) [0x7fdb07835890]
2 /lib/x86_64-linux-gnu/libc.so.6(+0xa9e8a) [0x7fdb06f39e8a]
3 /var/exchdb/exchange/app/matchengine() [0x5d4639]
4 /var/exchdb/exchange/app/matchengine(lh_insert+0x4c) [0x5d48ec]
5 /var/exchdb/exchange/app/matchengine(OBJ_NAME_add+0x63) [0x5a1f73]
6 /usr/lib/x86_64-linux-gnu/libssl.so.1.1(+0x33e5e) [0x7fdb06a19e5e]
7 /lib/x86_64-linux-gnu/libpthread.so.0(+0xf827) [0x7fdb07832827]
8 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1(CRYPTO_THREAD_run_once+0x9) [0x7fdb066fa8f9]
9 /usr/lib/x86_64-linux-gnu/libssl.so.1.1(OPENSSL_init_ssl+0x8b) [0x7fdb06a1a07b]
10 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20(+0x5b224) [0x7fdb07a9d224]
11 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20(mysql_server_init+0x67) [0x7fdb07a62c27]
12 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20(mysql_init+0x17) [0x7fdb07a6b397]
13 /var/exchdb/exchange/app/matchengine(mysql_connect+0x25) [0x46ce3d]
14 /var/exchdb/exchange/app/matchengine(init_from_db+0x21) [0x454106]
15 /var/exchdb/exchange/app/matchengine(main+0x37f) [0x45c505]
16 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7fdb06eb1b97]
17 /var/exchdb/exchange/app/matchengine(_start+0x29) [0x452d39]
===========backtrace=end===========

During investigation, it appears there is a conflict between libmysqlclient.so and libssl and since we are using bear metal, after update this problem started. we use docker for the build, but not for production. we are looking at a couple of solutions, one is to run ubuntu 16 instead of 18, the other is to copy the link lib to the execution folder of the match engine. since this is C we are also looking to see if its possible to embed the lib into the executable, so environment dependancies are reduced.
I am interested to know if anyone had this problem and what you did to resolve it. plus to maintain this engine future compatibility, it may be prudent to ensure as environments evolve, that the engine does to, for example, can we get this approved to run in ubuntu 18. since 16 is getting to no support levels soon.

@issacckm
Copy link

I think the problem is you are compiling in ubuntu 16, which has the linkage of lib libmysqlclient installed. But you are running the application in ubuntu 18, the installed libmysqlclient in 18 is not the same as the one in ubuntu 16. Therefore it got crashed when calling the undefined functions.
The solution is trying to compile the src in the same version of ubuntu. However, you will got compile errors when you compile in ubuntu 18.
In order to make it work, you can add the flag -no-pie to the linking options.
Edit your makefile.inc file like below:

CFLAGS  := -Wall -Wno-strict-aliasing -Wno-uninitialized -g -rdynamic -std=gnu99 -no-pie
LFLAGS  := -g -rdynamic -no-pie

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