Base solution for your next web application
Open Closed

Connection Pooling error when registering multiple users #7239


User avatar
0
omkarchoudhari created

registercustomuser throws timeout error

we are trying to register users one by one through loop using async api service,but it gives error when we are using AWS database(server DB). Some of users are registered successfully and for others, api gives 500 internal server error with Timeout expiration.

Message = "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."

this exception is thrown when registering multiple users:

$.each(result, function (index, obj) { graphUSers.id = obj.id; userobj.mail = obj.mail; userobj.surName = obj.surname; userobj.givenName = obj.givenName; _userService.registercustomuser(userobj).done(function (result) {

}) })

Can you please suggest resolution for this ? what options we can try to resolve this error ?

PS : we tried using/UnitOfWork statements in code but still it throws error

Thanks in advance.


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @omkarchoudhari

    This seems like an AWS related limitation. You must handle the error and wait a little bit for your next request exponentially. Something like a backoff strategy.

    A formula like this can be used:

    wait for (2^retryCount * 100) milliseconds