[CONCPP-87] Connector/C++ causes segfault in GCC version 7.3.1 Created: 2021-07-06  Updated: 2021-09-27  Resolved: 2021-09-27

Status: Closed
Project: MariaDB Connector/C++
Component/s: General
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Mark Sellers Assignee: Lawrin Novitsky
Resolution: Incomplete Votes: 0
Labels: api, c++, need_feedback, regexp, segfault
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, Connector/C++, GCC 7.3.1, Regex


Issue Links:
Blocks
blocks CONCPP-68 Disable build with gcc < 4.9 Closed

 Description   

Connector/C++ causes a segfault when the application uses the std::regex constructor. This was previously noted in another bug reported by Lawrin Novitsky. The previous bug was not researched/fixed but provided a work-around to use GCC revision >4.9 imposed by cmake.

See question on Stack Overflow for more info.

UPDATE:
I downloaded and compiled the MariaDB c+/connector on my server, and that fixed the problem. The MariaDB binary provided, as you indicated, uses c+ regex in its ParseUrl.cpp. Since it was compiled with an older version of GCC, the lib had a conflict with the current GCC implementation. I would suggest that you think about refactoring your code to not use the regex for this type of parsing, as it is slow to compile and run, and also produces a much larger executable that is generally required for simple parsing.

Thanks for your help



 Comments   
Comment by Lawrin Novitsky [ 2021-07-06 ]

Hello and thank you for your report.

These are 2 different issues you are talking about. Prior to 4.9 gcc did not have proper std::regex implementation. With 4.8 it's possible to build connector, but it crashes on first regex use.
Your problem is different.
Do I understand correctly, that the program runs well without adding std::regex instantiation to your program? i.e. it does not crash.

What binaries did you use for your test? CentOS7? Could you please try CentOS8 if so?

At the moment it looks like after appearing of 2nd std::regex in the application(first is template instantiation made in our binaries on our build machine), things get mixed up and that causes the crash. Like objects have different layout, and in the backtrace it can be seen that top 2 entries use regex headers from /usr/include/c++/7/bits/, while all previous use from /usr/local/include/c++/4.9.4/bits/
And on a side note - I don't think we are currently support Amazon Linux 2. Even though it kinda based on RHEL. I guess the best workaround for you would be building C/C++ binaries on the Amazon Linux 2 for own use.

Comment by Lawrin Novitsky [ 2021-07-07 ]

msellers@faststatic.io But which our binary did you use? My guess it's centos7, and that would be interesting if you tried centos8 binaries. I guess it can be different.

Generated at Thu Feb 08 03:08:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.