snowflake-db-net-client icon indicating copy to clipboard operation
snowflake-db-net-client copied to clipboard

Socket exhaustion

Open misteam opened this issue 2 years ago • 0 comments

There doesn't seem to be any way to dispose of the Snowflake Client once the operation is completed. Having embedded snowflake operations seems to lead to socket exhaustion.

System.IO.IOException: 'Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..' Inner Exception: SocketException: The I/O operation has been aborted because of either a thread exit or an application request.

Example:


            SnowflakeClient snowflakeClient = new SnowflakeClient(this.userName, this.password, this.account);

            var dbResults = await snowflakeClient.QueryAsync<MyObject>(sql: sqlQuery);
        
            List<MyObject> myObjects= new List<MyObject>();
            Parallel.ForEach(dbResults,async myObject=>
            {
                myObject.Address = await this.GetMyObjectAddressAsync(myObject.Id);
                myObject.Phones = await this.GetMyObjectPhoneNumbersAsync(myObject.Id);
                myObject.Emails = await this.GetMyObjectEmailAddressesAsync(myObject.Id);
                myObject.Employer = await this.GetMyObjectEmployerAsync(myObject.Id);
                myObject.Status = await this.GetMyObjectStatusAsync(myObject.Id);
                myObject.Tags = await this.GetMyObjectTagsAsync(myObject.Id);

                myObjects.Add(myObject);
            });
            return myObjects;


misteam avatar Jun 14 '23 14:06 misteam