Project

General

Profile

Actions

Bug #3786

open

Wt: fatal error: error executing prepared statement Lost connection to MySQL server during query

Added by Drus Kor almost 10 years ago. Updated almost 10 years ago.

Status:
InProgress
Priority:
Normal
Assignee:
Target version:
Start date:
02/05/2015
Due date:
% Done:

0%

Estimated time:

Description

after

Dbo::FixedSqlConnectionPool *pool = new Dbo::FixedSqlConnectionPool( new Dbo::backend::MySQL( "db", "login, "pass\" ) );

and

Dbo::Session session_;

session_.setConnectionPool( *pool ) ;

All works fine, but after some time, I get an error:

"Wt: fatal error: error executing prepared statement Lost connection to MySQL server during query"

How can I check that the connection is active?

or how to make it automatically re-created?

thx =)


Files

MySQL.C (32.2 KB) MySQL.C Drus Kor, 02/14/2015 12:59 PM
MySQL.C (31.4 KB) MySQL.C Drus Kor, 02/17/2015 05:53 PM
Actions #1

Updated by Drus Kor almost 10 years ago

sorry for the wrong section

Actions #2

Updated by Wim Dumon almost 10 years ago

Hello Drus,

As far as I know, we do configure mysql to reconnect automatically whenever the connection is lost.

How long is 'some time'?

BR,

Wim.

Actions #3

Updated by Drus Kor almost 10 years ago

Hello. Yes, in source code "reconnect automatically" is on, I checked.

just restart Mysql, ore reset connections. It is the fastest way.

In my case connections lost by timeout;

use:

@

static Dbo::FixedSqlConnectionPool pool( new Dbo::backend::MySQL( "db_test", "witty_user", "pass" , 10 );

// constructor section

session_.setConnectionPool( pool ) ;

@

Some additional:

Ubuntu 14.04.1

Mysql 5.5.41

Wt 3.3.3

Actions #4

Updated by Drus Kor almost 10 years ago

[[[http://comments.gmane.org/gmane.comp.lib.cppcms.user/968]]]

Actions #5

Updated by Wim Dumon almost 10 years ago

Does this solution work for you:

http://comments.gmane.org/gmane.comp.web.witty.general/9994

BR,

Wim.

Actions #6

Updated by Drus Kor almost 10 years ago

No, it does not always work.

It can lead to long delays ( performance )

I tried to write a handler of disconnection. But it seems that you are using exceptions to handle logic inside the library.

I attached the file, where I tried to implement error handling logic.

later continue working on it. maybe my decision will be useful.

Actions #7

Updated by Drus Kor almost 10 years ago

this solution works fine for me

I could make mistakes

Actions #8

Updated by Koen Deforche almost 10 years ago

  • Status changed from New to InProgress
  • Assignee set to Wim Dumon
  • Target version set to 3.3.4
Actions

Also available in: Atom PDF