The connection is broken - vb.net

I'm connecting to a PostgreSQL database with the npgsql connector.
On average, with one out of every 50 000 queries, I get the following error. (This was while filling a dataset.)
This is the Exception Message:
The Connection is broken.
This is the Exception Inner Exception:
System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. --->
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.FlushWrite()
at Npgsql.NpgsqlQuery.WriteToStream(Stream outputStream)
at Npgsql.NpgsqlReadyState.QueryEnum(NpgsqlConnector context, NpgsqlCommand command)
at Npgsql.NpgsqlCommand.GetReader(CommandBehavior cb)
Please let me know if I should rather post this in dba and if so I will repost.
Thanks.

Related

BizTalk Server 2016: WCF-SAP adapter

We have updated our environment to BizTalk 2016 and we are using WCF-SAP Send Port to invoke a SAP RFC.
We are receiving this error with NCo connection type. In BizTalk 2009 the same RFC with a Send Port WCF-SAP works perfect:
Error Description: Microsoft.ServiceModel.Channels.Common.MetadataException: RFC could not be resolved against SAP system because its metadata could not be obtained. ---> SAP.Middleware.Connector.RfcInvalidStateException: Lookup of function metadata failed for destination NCoConnection ---> SAP.Middleware.Connector.RfcCommunicationException: The only destination NCoConnection62.87.2.23P47PRUEBA002ESono_bztk available failed when retrieving metadata from -- see log for details
at SAP.Middleware.Connector.RfcRepository.findAlternateDestination(Int32& destIndex, Int32& alternativeDestinationsCount, Exception ex)
at SAP.Middleware.Connector.RfcRepository.Execute(RfcFunction function)
at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataClassic(String name)
--- End of inner exception stack trace ---
at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadataClassic(String name)
at SAP.Middleware.Connector.RfcRepository.LookupFunctionMetadata(String name)
at SAP.Middleware.Connector.RfcRepository.GetFunctionMetadata(String name)
at Microsoft.Adapters.SAP.NCo.RfcClientConnection.GetRfcFunctionInterface(String rfcName)
at Microsoft.Adapters.SAP.InternalRfcMetadata.InitializeRfcFieldsNCo(String originalRfcName, SAPConnection sapConnection)
at Microsoft.Adapters.SAP.SAPMetadataContract.ResolveOperationMetadata(String operationId, TimeSpan timeout, TypeMetadataCollection& extraTypeMetadataResolved)
at Microsoft.ServiceModel.Channels.Common.Design.MetadataCache.GetOperationMetadata(String uniqueId, Guid clientId, TimeSpan timeout)
at Microsoft.Adapters.SAP.SapFunctionMetadataNCo.ResolveOperationMetadataUsingSdkNCo(String absoluteName, String displayName, String funcName, String operationNamespace, SAPConnection sapConnection, Boolean isTrfc, MetadataLookup metadataLookup, TimeoutHelper timeoutHelper)
--- End of inner exception stack trace ---
Any idea?
Verify that the SAP system is set to unicode for this RFC, as stated here, where the similar problem is solved.
It also doesn't hurt to generate the SAP schema again in Visual Studio, maybe there are some changes.

SoftLayer (multiple) client responding with errors after API upgrade

I am having issues connecting to the SoftLayer Product/Orders APIs.
Endpoints: Product_Packages is dropping the connection, Product_Place_Orders is returning invalid auth. Hardware and VirtualGuests are accepting the credentials and returning the information I expect.
Either:
Invalid credentials
Connection reset by peer
I am, however, able to use the same credentials to see what machines and vlans are in the account.
Looking into this more, curl works, another client I have works still, however the SoftLayer python client stopped working overnight.
Did the API change Auth mechanisms change last night?
import SoftLayer
client = SoftLayer.create_client_from_env() # or
client = SoftLayer.create_client_from_env(endpoint_url="https://api.softlayer.com/rest/v3/")
location_groups = client.call('Location_Group_Pricing', 'getAllObjects')
Output:
Unexpected error: <class 'SoftLayer.exceptions.TransportError'>
Traceback (most recent call last):
File "list_product_options.py", line 28, in <module>
location_groups = client.call('Location_Group_Pricing', 'getAllObjects')
File "/Users/tony/alchemy/ibm-krobots/sl-tools/slcli/lib/python2.7/site-packages/SoftLayer/API.py", line 263, in call
return self.transport(request)
File "/Users/tony/alchemy/ibm-krobots/sl-tools/slcli/lib/python2.7/site-packages/SoftLayer/transports.py", line 199, in __call__
raise exceptions.TransportError(0, str(ex))
SoftLayer.exceptions.TransportError: TransportError(0): ('Connection aborted.', error(54, 'Connection reset by peer'))
catching the exception shows the following:
Unexpected error: <class 'SoftLayer.exceptions.TransportError'>
A working curl for the same endpoint:
curl https://<username>:<api_key>#api.softlayer.com/rest/v3/SoftLayer_Location_Group_Pricing/getAllObjects.json
Also verified that the Golang client works.
https://github.com/softlayer/softlayer-go
Just to point out that I am experiencing the same issue and I believe there is another post from someone else also mentioning the same transport/connection forcibly closed issue.
Worked last night, not working today. I'm changing my api key and user_name to see if it gets fixed. Note I too have multiple SL accounts. I'm swapping to my primary account API credentials to see what happens.
Here is the error
Unable to read data from the transport connection: An existing connection was fo rcibly closed by the remote host.
System.Net.WebException: The underlying connection was closed: An unexpected err or occurred on a send. --->
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the
remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequestrequest)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at SoftlayerAPIV2.Softlayer.Account.SoftLayer_AccountService.getAdcLoadBalancers
After talking with SoftLayer support, there was a service issue which has now been resolved.
Future Mitigation:
More extensive testing for older clients and related systems will be implemented into our Change Management guidelines to prevent this type of issue in the future.
(I like that part :)
This was an issue in Softlayer side, please try again it should be fixed now.
Regards
We don't have any report about issues for that, and I'm able to use SoftLayer_Product_Order service, could you provide your request(s)? for further assistance
How often have you been getting this issue?
Did you have success with those request before?

Loading a flat file into SQL Server 2008 R2 via BizTalk 2010

I am trying to find my way around BizTalk 2010. The scenario is simple: I need to take a flat file (delimited, positional, segmented etc...) and load it into a table in SQL Server 2008 R2.
I am trying to do this with a WCF-SQL adapter.
At this point I do not care for speed (i.e., it does not matter if there will be multiple inserts or one bulk insert, but in the long run I would like to be able to do a bulk insert), I just want to get something working.
I have the following done so far:
TestTable1 in table in SQL Server 2008 R2
InsertIntoTestTable stored procedure in SQL Server 2008 R2
Visual Studio Project with (a) a schema for the incoming Flat File, (b) Generated Schema for the SQL table, (c) a Map from the incoming flat file schema to the SQL file schema and (d) a pipeline to disassemble the flat file.
I have deployed this project to BizTalk and created a receive port for the flat file specifying the receive folder and inbound map. When I drop a test file into the receive folder, it disappears but TestTable1 is not loaded with any values.
What am I missing? Where does BizTalk place the test file? How can I set this up?
I have looked over a number of tutorials (https://msdn.microsoft.com/en-us/biztalk/gg153515, https://sandroaspbiztalkblog.wordpress.com/2012/08/20/biztalk-server-transform-text-files-flat-files-into-xml-a-practical-example-part-3/, ) but just don't understand what I am missing.
Any help will be greatly appreciated.
So I got it to work. Not sure how yet, but I tweaked the adapter settings and changed the value of Quantity in the input file from 1.000 to 1. I also now able to write to an xml file. The error that I was getting is as follows looks like it was having problems with "Quantity" data type:
The adapter failed to transmit message going to send port "ToSQL" with URL "mssql://.//TestDB?". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The input data for the field/parameter "Quantity" is invalid according to the expected SqlDbType Int. ---> System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at Microsoft.Adapters.Sql.MetadataHelper.ConvertXmlValueToDotNetObject(String xmlString, String fieldParameterName, SqlDbType sqlDbType, Int32 maxLength, Int32 precision)
--- End of inner exception stack trace ---
Server stack trace:
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)".
Based on your error:
Quantity" is invalid according to the expected SqlDbType Int.
'1.000' is not a valid int type.
you should convert it to a valid format such as "1"

RavenDB connection issues

We have seen a noticeable uptick in problems related to RavenDB connections. We're using the IIS server connection method.
I've checked the index errors and I don't see anything listed.
This server is replicated with a MySQL server and there is one error related to replication in the log from today. Could the client stack trace errors actually be coming from the replicated server and not Raven?
EDIT
The client in this case is a single job that runs a few hundred times a day...succeeding many of those times but increasing in failures due to these errors.
Sql Replication failure to replication
Here are the partial stack trace errors from the client log:
[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.GetRequestStream(TransportContext& context):367
System.Net.HttpWebRequest.GetRequestStream():3
Raven.Abstractions.Connection.HttpRequestHelper.WriteDataToRequest(HttpWebRequest req, String data, Boolean disableCompression):7
Raven.Client.Connection.ServerClient.DirectBatch(IEnumerable`1 commandDatas, String operationUrl):171
Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result, Boolean& wasTimeout):35
Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation):169
Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation):33
Raven.Client.Document.DocumentSession.SaveChanges():65
and
[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.GetResponse():570
Raven.Client.Connection.HttpJsonRequest.ReadJsonInternal(Func`1 getResponse):45
Raven.Client.Connection.HttpJsonRequest.ReadResponseJson():206
Raven.Client.Connection.ServerClient.DirectGet(String[] ids, String operationUrl, String[] includes, String transformer, Dictionary`2 queryInputs, Boolean metadataOnly):631
Raven.Client.Connection.ServerClient+<>c__DisplayClass77.<Get>b__76(String u):51
Raven.Client.Connection.ReplicationInformer.TryOperation[T](Func`2 operation, String operationUrl, Boolean avoidThrowing, T& result, Boolean& wasTimeout):35
Raven.Client.Connection.ReplicationInformer.ExecuteWithReplication[T](String method, String primaryUrl, Int32 currentRequest, Int32 currentReadStripingBase, Func`2 operation):169
Raven.Client.Connection.ServerClient.ExecuteWithReplication[T](String method, Func`2 operation):33
Raven.Client.Document.HiLoKeyGenerator.GetDocument(IDatabaseCommands databaseCommands):41
Raven.Client.Document.HiLoKeyGenerator.GetNextRange(IDatabaseCommands databaseCommands):109
Raven.Client.Document.HiLoKeyGenerator.NextId(IDatabaseCommands commands):58
Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(IDatabaseCommands databaseCommands, DocumentConvention convention, Object entity):9
Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(IDatabaseCommands databaseCommands, DocumentConvention conventions, Object entity):174
Raven.Client.Document.DocumentStore+<>c__DisplayClass4.<Initialize>b__2(String dbName, IDatabaseCommands databaseCommands, Object entity):20
Raven.Client.Document.DocumentConvention.GenerateDocumentKey(String dbName, IDatabaseCommands databaseCommands, Object entity):164
Raven.Client.Document.GenerateEntityIdOnTheClient.GenerateDocumentKeyForStorage(Object entity):46
Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object entity, Etag etag, String id, Boolean forceConcurrencyCheck):79
Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object entity):23
The error says the client cannot connect to the the server. Maybe the client is offline. Or the server is. Or a firewall is in the way. Or maybe the server is there but blows up before returning a response to the client. If the issue is intermittent, and users arent complaining, it's probably just a connectivity thing that you can ignore. If users are complaining, you should look in server-side logs.

Booksleeve (1.3.39) + Redis 2.6.16 + Sentinel: The connection has been closed (Error)

I am getting some random disconnects from Booksleeve when deployed in the production environment. I have run tests on my machine and I can not seem to reproduce the errors. I am not sure what to check so I decided to post here.
My set-up:
2 x Redis 2.6.16 (Debian Linux)
2 x Redis sentinel (running on the same machines as redis)
4 x Windows Server 2008 R2
Application connection handling
My app has one static connection that is opened using ConnectionUtils. I also have a timer (System.Timers.Timer) that runs every connection.Ping every 5'' to check whether the connection is still open. If I get an exception for the Ping I log it, close and dispose the connection and replace it with a new one using ConnectionUtils again.
I am also logging Task.UnobservedExceptions
Here is what I am getting in my logs:
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)
at BookSleeve.RedisMessage.WriteUnified(Stream stream, Byte[] value) in d:\Dev\BookSleeve\BookSleeve\RedisCommand.cs:line 271
at BookSleeve.RedisMessage.RedisMessageMulti.Write(Stream stream) in d:\Dev\BookSleeve\BookSleeve\RedisCommand.cs:line 564
at BookSleeve.RedisConnectionBase.WriteMessage(Int32& db, RedisMessage next, IList`1 queued) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1597
at BookSleeve.RedisConnectionBase.EnqueueMessage(RedisMessage message, Boolean queueJump) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1965
at BookSleeve.RedisConnectionBase.ExecuteInt64(RedisMessage message, Boolean queueJump, Object state) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1688
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)
at BookSleeve.RedisMessage.WriteUnified(Stream stream, Byte[] value) in d:\Dev\BookSleeve\BookSleeve\RedisCommand.cs:line 271
at BookSleeve.RedisMessage.RedisMessageMulti.Write(Stream stream) in d:\Dev\BookSleeve\BookSleeve\RedisCommand.cs:line 564
at BookSleeve.RedisConnectionBase.WriteMessage(Int32& db, RedisMessage next, IList`1 queued) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1597
at BookSleeve.RedisConnectionBase.EnqueueMessage(RedisMessage message, Boolean queueJump) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1965
at BookSleeve.RedisConnectionBase.ExecuteInt64(RedisMessage message, Boolean queueJump, Object state) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1688
at System.Threading.Tasks.Task.Execute()
And this is my connection monitor reporting on the error in the ping:
Redis connection is broken: System.InvalidOperationException: The connection has been closed (Error); no new messages can be delivered; the last command was sent 1453ms ago
at BookSleeve.RedisConnectionBase.EnqueueMessage(RedisMessage message, Boolean queueJump) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1965
at BookSleeve.RedisConnectionBase.ExecuteInt64(RedisMessage message, Boolean queueJump, Object state) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 1688
at BookSleeve.RedisConnectionBase.PingImpl(Boolean queueJump, Boolean duringInit, Object state) in d:\Dev\BookSleeve\BookSleeve\RedisConnectionBase.cs:line 129
at Atcom.Data.Caching.RedisConnectionContainer.CheckConnections(Object sender, EventArgs e) in C:\Projects\Atcom.Data.Caching.Redis\Atcom.Data.Caching.Redis\RedisConnectionContainer.cs:line 66
I have tried connecting through both the Sentinels and directly to Redis but I am getting the same thing.
I have asked my network administrator to check but he says there is no problem (and I cant really argue with what I dont know oO)
I have reviewed Redis settings and documentation and as far as I can tell clients that do not use monitor etc. should not get disconnected by redis. Idle time disconnect is also disabled on redis.
Could sentinel (since its beta) be the culprit?
Any help troubleshooting the problem would be GREATLY appreciated.