Time out issue with CRM Online service object - dynamics-crm

I am working on MS D CRM Online V8.0. I have written a Windows Service that bulk updates records for an entity (500 record each time). I am facing a time out issue and authentication failure with the service object. We have set the time out to 10 mins.
Algorithm:
Fetch 500 Records for Entity
Update the same records. Set Status = In progress
Do the Process
Create the service object again
Update the records. Set Status = Complete.
I get the below exception
2018-03-05 09:36:04,267 [1] DEBUG -
System.ServiceModel.CommunicationException: The underlying connection
was closed: The connection was closed unexpectedly. --->
System.Net.WebException: The underlying connection was closed: The
connection was closed unexpectedly. at
System.Net.HttpWebRequest.GetResponse() at
System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan
timeout) --- End of inner exception stack trace ---

Related

o.h.engine.jdbc.spi.SqlExceptionHelper : FATAL: query_wait_timeout

I am using SpringBoot application with PostgreSQL as database, I am doing Load Testing from Jmeter, Database is hosted in azure, when I try to hit 150 Rest request to Single API or endpoint parallelly/concurrently, I am getting below error but with 100 request it works successfully.
ERROR:
2022-12-21 17:29:43.000 WARN 1 --- [http-nio-8080-exec-60] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08P01
2022-12-21 17:29:43.000 ERROR 1 --- [http-nio-8080-exec-60] o.h.engine.jdbc.spi.SqlExceptionHelper : FATAL: query_wait_timeout
2022-12-21 17:29:43.000 WARN 1 --- [http-nio-8080-exec-60] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08006
2022-12-21 17:29:43.001 ERROR 1 --- [http-nio-8080-exec-60] o.h.engine.jdbc.spi.SqlExceptionHelper : An I/O error occurred while sending to the backend.
2022-12-21 17:29:43.090 WARN 1 --- [http-nio-8080-exec-61] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 08P01
2022-12-21 17:29:43.090 ERROR 1 --- [http-nio-8080-exec-61] o.h.engine.jdbc.spi.SqlExceptionHelper : FATAL: query_wait_timeout
I want to improve the performance of the application in short solve the above error when we auto-scale our application with two instances, 150 request are passed but when we run with a single instance, it gives the above error, I want to understand
whether it is a memory issue or a db issue?
How to resolve it ?`
As per documentation:
query_wait_timeout
Maximum time queries are allowed to spend waiting for execution. If the query is not assigned to a server during that time, the client is disconnected. 0 disables. If this is disabled, clients will be queued indefinitely. [seconds]
This setting is used to prevent unresponsive servers from grabbing up connections. It also helps when the server is down or rejects connections for any reason.
Default: 120
Most probably all the connections in the PostgreSQL connection pool are busy and your application fails to obtain one within the bounds of pre-defined timeout of 2 minutes.
The options are in:
Increase connection pool size
Increase the aforementioned timeout
Check Postgresql slow queries logs and execution plans for these queries
Test the database in isolation using JDBC Request sampler
Use a profiler tool like JProfiler or YourKit to see whether the long processing is somewhere in your application source code.

How to replication Connection reset by peer in Spring boot?

In my production environment I got the following error in my server:
Cannot forward to error page for request [/api/validation] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer
Now I created a client and produced 1000 thread every second to call this [/api/validation].
The error I got was
Exception in thread "Thread-9954" org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:7080/v1/name/validate": Timeout waiting for connection from pool; nested exception is org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool.
Now I want to know is what is the cause of Connection reset by peer .
According to what I know is this error occurs when the client aborts the connection by sending the RST packet.
I set the socket Timeout of my client's rest template to 9000. I make the server sleep for about 15000 MS. Now shouldn't the server get Connection reset by peer as the server tries to send the response after 15 seconds and my client just waits for about 9 seconds. Shouldn't I get the error?
Also in the production environment the wait time (Rest template socket time out) for the client is set to about a 90 seconds ( more than the time the server requires to response). Why is the error being produced in the production?

Snowflake JDBC Connection using Talend

I am using tDBConnection(JDBC) component to connect with a snowflake.
After all the setup I am getting the below error
net.snowflake.client.jdbc.RestRequest execute
SEVERE: Stop retrying since elapsed time due to network issues has reached
timeout. Elapsed: 71,253(ms), timeout: 60,000(ms)
Exception in component tDBConnection_1 (sf_test)
java.lang.RuntimeException: JDBC driver encountered communication error. Message: Exception encountered for HTTP request: Certificate for <xxxxxxxxxx.ap-southeast-1.snowflakecomputing.com> doesn't match any of the subject alternative names: [*.ap-southeast-1.snowflakecomputing.com, *.global.snowflakecomputing.com, *.sg.ap-southeast-1.aws.snowflakecomputing.com].
at snowflake_poc.sf_test_0_1.sf_test.tDBConnection_1Process(sf_test.java:397)
at snowflake_poc.sf_test_0_1.sf_test.runJobInTOS(sf_test.java:700)
at snowflake_poc.sf_test_0_1.sf_test.main(sf_test.java:550)
I am using latest snowflake JDBC driver 3.12.2
Any leads would be really helpful
Thanks
I had the similar issue, in the Talend account box just give your account name alond which is "<xxxxxxxxxx.ap-southeast-1" don't postfix snowflakecomputing.com to your account name

Connection refused: connect Aborting action - session using JMeter

I have 50 threads test in JMeter with multiple session but when I test it half of the threads is failed and I got this error Connection:
Response code: 500
Response message: Connection refused: connect Aborting action - session 656255658 was closed
Check 2 things:
are you sure you’re not reusing same session accross threads ? Are you correctly correlating the session id.
If issue only happens over some limit (not at 25 users for example, but at 50) then it’s a load issue or configuration limit on server side

Cannot get a connection, pool error Timeout waiting for idle object in PutSQL?

I have increased the concurrent tasks to be '10' for PutSQL processor.
At that time it shows below error but there is no data loss.
failed to process due to org.apache.nifi.processor.exception.ProcessException: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object; rolling back session:
if i have remove concurrent tasks then it worked without those exception
while google this exception i have found answer in below link
I am getting Cannot get a connection, pool error Timeout waiting for idle object, When I try to create more than 250 threads in my web application
But i don't know how to avoid this issue in NiFi putSQL.
Can anyone help me to resolve this?
This exception occurs when the pool manager cannot produce a viable connection to a waiting requester and the maxWait has passed therefore triggering a timeout.
There are several causes, but they usually fall into 2 main categories:
The DB is down or unreachable.
The connection pool (which is set to 100 max active) is out of connections.
DBCPConnectionPool controller service in nifi has 8 max connection by default and 500 milli seconds max wait time. When PutSQL processor occupied 8 connection from DBCP pool and when it request for 9th connection or exceed the max connection limit then it will throw "Cannot get a connection" exception.
You can try 2 things to avoid this Exception :
You can increase the "Max Wait Time" in DBCPConnectionPool controller
service configuration.
You can increase the "Max Total Connections" limit in
DBCPConnectionPool controller service configuration.
Kindly find the below screenshot where you need to do changes.
It might resolve your issue.
This exception can occurs if some connections are never closed so they do not become available in the pool again.
So more and more connections remain open until reaching the max.
Make sure all threads are closing the connections used.

Resources