edgedb / edgedb-net

The official .NET client library for EdgeDB
https://edgedb.com
Apache License 2.0
82 stars 9 forks source link

EdgeDBConnection.FromDSN creates critical failure in built client #39

Closed PastelStoic closed 1 year ago

PastelStoic commented 1 year ago

When attempting to create a client using a DSN, the following error is thrown:

System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter. (Parameter 'maxCount')
Actual value was 0.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.SemaphoreSlim..ctor(Int32 initialCount, Int32 maxCount)
   at EdgeDB.ClientPoolHolder.<ResizeAsync>d__6.MoveNext()
   at EdgeDB.EdgeDBClient.<>c__DisplayClass50_0.<<CreateClientAsync>g__OnConnect|0>d.MoveNext()
   at EdgeDB.EventExtensions.<InvokeAsync>d__2`1.MoveNext()
   at EdgeDB.EdgeDBBinaryClient.<ConnectAsync>d__59.MoveNext()
   at EdgeDB.EdgeDBBinaryClient.<ReconnectAsync>d__61.MoveNext()
   at EdgeDB.EdgeDBBinaryClient.<ExecuteInternalAsync>d__47.MoveNext()
   at EdgeDB.EdgeDBBinaryClient.<QuerySingleAsync>d__50`1.MoveNext()
   at EdgeDB.EdgeDBClient.<QuerySingleAsync>d__43`1.MoveNext()
   at EdgeDB.EdgeDBClient.<QuerySingleAsync>d__43`1.MoveNext()
   at Program.<<Main>$>d__0.MoveNext() in C:\Users\{me}\source\repos\edgeql-test\Program.cs:line 12

Reproduction

using EdgeDB;

var edgeConnection = EdgeDBConnection.FromDSN("valid_dsn");
edgeConnection.TLSSecurity = TLSSecurityMode.Insecure;
var client = new EdgeDBClient(edgeConnection);

// any query produces the same result
await client.QuerySingleAsync<int>("SELECT 2");

DSN was testing using both the Node.js client and the CLI, and was able to execute queries.

Versions

PastelStoic commented 1 year ago

Update: turns out this was caused by a mis-typed username, which caused a deadlock.