Ticket #153 (closed defect: noresponse)

Opened 5 months ago

Last modified 3 weeks ago

Thread problem even though each threads as its own connection version 2.6.8 on debian

Reported by: henke@mac.se Assigned to: jtv
Priority: highest Milestone:
Component: connections Version: 2.6
Severity: critical Keywords:
Cc:

Description

We have a threaded application that copies files over a network. One thread called PRODUCER connects to database and retrieves file information and fills a buffer. Another thread called CONSUMER reads this buffer and copies the files. The problem is that we have a small function that updates the progress in the databas when the files are copied which is done from the CONSUMER thread. Even those this little function has its own local variable database connection it collides with the connection in the PRODUCER thread. How is this possible? How can we easily solve this? We thought that this would be safe as they do not share connection.

Attachments

Change History

08/17/08 05:17:10 changed by jtv

  • status changed from new to assigned.

I would think so too. Are you linking to a thread-safe build of libpq, and do you have a thread-safe version of strerror?

Also, what kind of conflicts are you seeing, exactly? Could it be a matter of interacting transactions?

08/18/08 15:11:40 changed by henke@mac.se

I actually installed both libpq and libpqxx through ubuntu hardys packet installer. Is there somewhere I can check if its been compiled with the thread-safe flag?

The error I get is: FATAL: invalid frontend message type 44

I asked around in the PostgreSQL community and someone recalled getting the same error when accidentally used the same connection in two threads.

08/19/08 01:30:55 changed by jtv

It could happen if one thread uses objects that refer to the other thread's connection, but if I understand you correctly, that is not the case here.

Then again, it might not be a threading issue at all. If you use the tablestream classes to read/write data, or use asyncconnection or lazyconnection, there might be a problem with state transitions. Finally, it could be a data problem: what kind of data are you reading? If there are any strings, are you sure that they are correctly-encoded text that the database's locale can handle?

12/14/08 00:50:09 changed by jtv

  • status changed from assigned to closed.
  • resolution set to noresponse.

Add/Change #153 (Thread problem even though each threads as its own connection version 2.6.8 on debian)




Change Properties
Action