Subject | Re: [firebird-support] Multithreading problem - error reading data from the connection |
---|---|
Author | Helen Borrie |
Post date | 2006-10-16T23:15:45Z |
At 05:42 AM 17/10/2006, you wrote:
1. Is the ClientDataset thread-isolated? If it is in the main
thread, then it is not...the Provider and the CDS must be in the same
thread context..the safest way is to isolate everything in a
datamodule that is created and destroyed by the thread.
2. Assuming the CDS is properly isolated, are you certain that all
activity within the connection is complete before the thread is
destroyed? (Events alerters and their notifications, fetches from
the provider, stored procedures committed, etc.)
3. Hopefully you are not trying to share an event alerter between
multiple threads...
4. Also check your DPR to make sure that the application startup is
not creating an instance of the datamodule. (Yep, this is a "newbie"
error but even experts forget sometimes!)
5. Does the log indicate whether the connection loss occurs on the
client side or the server side? This might give some clues as to
what is happening with the sockets.
6. You're not trying to multi-thread local connections, are you? (I
mean libfbembed.so or IPServer clients...)
./heLen
>Hi,Things I would look at:
>
>I have application with heavy forms and try to make some late loading
>of data with threads. I made a simple thread class in Delphi which takes
>a MDOQuery (similar to IBX components) and linked to it ClientDataSet.
>In the thread I create a separate MDODatabase and MDOTransaction and
>attach Query component to them. Then I open ClientDataSet to fetch all
>records.
>In about 10% of tests I get "error reading data from the connection"
>when try to open some of MDODataset components in main thread just
>after the thread was fetched its records.
>
>I am almost sure that two threads use different MDODatabase components
>- I look at the Handle property trough OutputDebugString before open of
>DataSet.
>Is there any other prerequisites for multithreading work with
>Firebird, except connection-per-thread?
>
>Any ideas are very
1. Is the ClientDataset thread-isolated? If it is in the main
thread, then it is not...the Provider and the CDS must be in the same
thread context..the safest way is to isolate everything in a
datamodule that is created and destroyed by the thread.
2. Assuming the CDS is properly isolated, are you certain that all
activity within the connection is complete before the thread is
destroyed? (Events alerters and their notifications, fetches from
the provider, stored procedures committed, etc.)
3. Hopefully you are not trying to share an event alerter between
multiple threads...
4. Also check your DPR to make sure that the application startup is
not creating an instance of the datamodule. (Yep, this is a "newbie"
error but even experts forget sometimes!)
5. Does the log indicate whether the connection loss occurs on the
client side or the server side? This might give some clues as to
what is happening with the sockets.
6. You're not trying to multi-thread local connections, are you? (I
mean libfbembed.so or IPServer clients...)
./heLen