Hello,
I created a small WPF-Application with the following Code (see below) trying asnyc / await.
The Test is to open 10 Connections Asynchronous / Parallel and messure the time of the whole ButtonClick and the time for the open of each connection.
When Pooling is off (Pooling = false), everything works as expected, but with active pooling (Pooling = true) the application hangs / crashes or throws ORA-50000: Connection request timed out.
Is there any reason for this?
private async void OpenButton_Click(object sender, RoutedEventArgs e)
{
var connlst = new List<OracleConnection>();
for (int i = 0; i < 10; i++)
{
connlst.Add(GetConnection());
}
var watch = Stopwatch.StartNew();
var taskconnlst = connlst.Select(x => MyOpenDebug(x)).ToList();
await Task.WhenAll(taskconnlst);
watch.Stop();
MyTextBox.Text = "Sum: " + watch.ElapsedMilliseconds + "\r\n";
foreach (var item in taskconnlst)
{
MyTextBox.Text += "Opened: " + item.Result + "\r\n";;
}
}
private async Task<string> MyOpenDebug(OracleConnection iConn)
{
var watch = Stopwatch.StartNew();
await iConn.OpenAsync();
watch.Stop();
return watch.ElapsedMilliseconds.ToString();
}
private OracleConnection GetConnection()
{
OracleConnectionStringBuilder builder = new OracleConnectionStringBuilder();
builder.UserID = "user";
builder.Password = "password";
builder.DataSource = "IP:Port/Sid";
builder.Pooling = false;
builder.MinPoolSize = 0;
builder.MaxPoolSize = 10;
OracleConnection conn = new OracleConnection(builder.ConnectionString);
return conn;
}