pubnub / dart

PubNub Dart SDK
Other
28 stars 15 forks source link

Pool resources not released on time? #62

Closed aadil058 closed 2 years ago

aadil058 commented 3 years ago

I had to increase pool resources from 10 to 100 to be able to send messages. With the default 10 resources limit .publish() kept waiting and waiting for resources to release forever.

SDK version 4.0.0.beta-1

are commented 3 years ago

Hi! This certainly seems weird - the resources should be recycled quite well in most cases. Can you let us know the circumstances where the pool gets exhausted? There may be a leak in the code that prevents pool resources from being released.

Is this happening after the app runs for a long time? Or after a lot of exceptions?

aadil058 commented 3 years ago

Hi, I got 9 to 10 timeouts/exceptions in the logs but couldn't figure out from where they were originating. Now, I think they were coming from the SDK. Also, the app wasn't running for a long time. Sometimes I was able to send messages and sometimes I was not (.publish kept waiting forever). If I was not able to send messages I had to restart the app if I were lucky I was able to send the messags.

One thing that I would like to mention is I have some listeners/subscriptions (maybe 10 to 15) set up to actively listen for incoming messages (Note: they are active all the time). Maybe I have too many subscriptions at the same time is causing this behavior?

I think if the network job is canceled abruptly or the response code is not a success (i.e., 200 - 299) then resources are not released. Am I right or missing something?

are commented 3 years ago

Subscriptions/listeners don't take up resources from resource pool, but I think you may be up to something with that last sentence. I'll test this and make sure that resources are released properly on job failure. Thanks for reporting this issue to us!

github-actions[bot] commented 2 years ago

@aadil058 this issue is addressed in v4.0.0