SCM

[#1002786] MultiThreadProblem

View Trackers | Bugs | Download .csv | Monitor

Date:
2007-04-02 09:06
Priority:
3
State:
Open
Submitted by:
tsukasa shimomura (tsukasa)
Assigned to:
Nobody (None)
Npgsql Version:
1.0
Category:
Group:
Resolution:
None
Summary:
MultiThreadProblem

Detailed description
Hello.
My name is TSUKASA that lives in Japan.

It is embarrassing it due to the trouble now.

It connects it by using Npgsql for Postgres7.4X with VB.NET2005.
(Mono.seculity and npgsql use the latest one.)

The following errors occur if Open is done by using BackGroundWorker, and using Npgsql from another Thread though it is unquestionable in a usual connection.
"Connection establishment timeout. Increase Timeout value in ConnectionString."

The code at that time is shown as follows.
-----------------------------------
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As systemm.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
dim cnn as string=""
cnn ="Server=192.168.xxx.xxx;Port=5432;User Id=id;password=pass;Database=test;Encoding=UNICODE;timeout=60;"
Using cnn As New Npgsql.NpgsqlConnection()
cnn.Open()
cnn.Close()
End Using

End Sub
--------------------------------------

It is writing like this.
At this time, to confirm it was not a mistake of the setting, the following two codes were prepared.
---------------------------------
Private Sub btnRead1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead1Click
Call BackGroundDataRead_DoWork(Me, New System.ComponentModel.DoWorkEventArgs(Nothing))
End Sub

Private Sub btnRead2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead2Click
Me.BackGroundDataRead.RunWorkerAsync(Params)
End Sub
------------------------------
I think that an example that calls from the main thread and is latter is a call from another thread of the example of the former.
The former succeeds when there is no problem of the network and etc.
The failing time sometimes succeeds in the latter by 99%.

Could you give information if there is experiencing the problem of such a connection by the call outside the main thread?

Sorry it is unskilled sentences.

-Tsukasa-

Followup

Message
Date: 2007-04-24 03:11
Sender: Josh Cooley

Tsukasa,

How many background threads do you have?

Josh
Date: 2007-04-02 09:18
Sender: Nobody

Sorry!

Private Sub btnRead2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead2Click
Me.BackGroundDataRead.RunWorkerAsync(Params)
End Sub


Private Sub btnRead2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead2Click
Me.BackGroundDataRead.RunWorkerAsync()
End Sub

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge