Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
Qt 4.3 and MySQL: sigsegv


Message 1 in thread

Hi,

I wrote an app for storing simple text data into an MySQL 5.0.26 database
on openSuSE 10.2 (32bit) using Qt 4.3.0 compiled as static with -qtsql-mysql
and gcc 4.1.2.

Due to massive multithreading I create the QSqlDatabase and QSqlQuery objects
for each request (2-4 requests for "insert" per second, max. 310 Bytes per request).

After 6000 - 8000 requests, my app crashes with a sigsegv in the mysql client
lib:

#0  0x6e69206c in ?? ()
#1  0xb7e6ad91 in net_realloc () from /usr/lib/libmysqlclient_r.so.15
#2  0xb7e6b29b in my_net_read () from /usr/lib/libmysqlclient_r.so.15
#3  0xb7e65799 in cli_safe_read () from /usr/lib/libmysqlclient_r.so.15
#4  0xb7e67b1c in mysql_real_connect () from /usr/lib/libmysqlclient_r.so.15
#5  0x0808eb3c in QMYSQLDriver::open ()

or like this:

#0  0xb7e5abe7 in mysql_character_set_name ()
   from /usr/lib/libmysqlclient_r.so.15
#1  0x0808cdb9 in QMYSQLDriver::open ()
#2  0x0807ace1 in QSqlDatabase::open ()

The problem is the multithreading - all of my objects are created in main()
and then 4 threads call the processing methods of my objects (e.g. the
method for executing the sql inserts).

Has anyone an idea how to solve this problem or an advice for
the design?

Any hints are appreciated.

Best Regards,
Christian


--
 [ signature omitted ] 

Message 2 in thread

Christian Dähn wrote:

> Hi,
> 
> I wrote an app for storing simple text data into an MySQL 5.0.26 database
> on openSuSE 10.2 (32bit) using Qt 4.3.0 compiled as static with
> -qtsql-mysql and gcc 4.1.2.
> 
> Due to massive multithreading I create the QSqlDatabase and QSqlQuery
> objects for each request (2-4 requests for "insert" per second, max. 310
> Bytes per request).
> 
> After 6000 - 8000 requests, my app crashes with a sigsegv in the mysql
> client lib:
[...]
> The problem is the multithreading - all of my objects are created in
> main() and then 4 threads call the processing methods of my objects (e.g.
> the method for executing the sql inserts).
> 
> Has anyone an idea how to solve this problem or an advice for
> the design?
I think you'd better start pooling your resources. I mean: creating a new db
connection for each and every insert is overkill and not a good idea. Why
not create a LILO-queue of your inserts, and create an object that lives in
another thread that pushes these into you database. 

I hope that helps.

Regards,

Andre

--
 [ signature omitted ] 

Message 3 in thread

Hi,

> I think you'd better start pooling your resources. I mean: creating a new db
> connection for each and every insert is overkill and not a good idea. Why
> not create a LILO-queue of your inserts, and create an object that lives in
> another thread that pushes these into you database. 

That's a good hint. The complex thing is that I need a blocking call - so I've to
wait for the result (for checking if insert was successful) of the insert request.

I'll test implementing a pool of sql connections, so each thread has its own
sql database connection. ..let's see how it works ;-)

Best Regards,
Christian




--
 [ signature omitted ] 

Message 4 in thread

I'm in the process of porting a Qt 3 application to Qt 4.

In part of my code, I create a custom tab page widget and add it to a QTabWidget:
   _tabWidget->addTab(page, QString());

This results in the error message:
   QPaintEngine::setSystemClip: Should not be changed while engine is active

Any idea why I'm getting this? I've had a look at qt-interest, but not found anything except discussion of QWidget::update() which I'm not calling (directly, at least).

Sam Dutton
 





SAM DUTTON
SENIOR SITE DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4496
F 
E SAM.DUTTON@xxxxxxxxx
WWW.ITN.CO.UK

P  Please consider the environment. Do you really need to print this email?
Please Note:

 

Any views or opinions are solely those of the author and do not necessarily represent 
those of Independent Television News Limited unless specifically stated. 
This email and any files attached are confidential and intended solely for the use of the individual
or entity to which they are addressed. 
If you have received this email in error, please notify postmaster@xxxxxxxxx 

Please note that to ensure regulatory compliance and for the protection of our clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.