Title: Error when two requests are too close in time · spotify-web-api-java/spotify-web-api-java · Discussion #367 · GitHub
Open Graph Title: Error when two requests are too close in time · spotify-web-api-java/spotify-web-api-java · Discussion #367
X Title: Error when two requests are too close in time · spotify-web-api-java/spotify-web-api-java · Discussion #367
Description: Error when two requests are too close in time
Open Graph Description: Hi, I'm getting this error when I make a request close after another (not always, it's a range, not inmediate and not long after it): java.lang.IllegalStateException: Connection 192.168.1.152:43204...
X Description: Hi, I'm getting this error when I make a request close after another (not always, it's a range, not inmediate and not long after it): java.lang.IllegalStateException: Connection 192.168.1.1...
Opengraph URL: https://github.com/spotify-web-api-java/spotify-web-api-java/discussions/367
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Error when two requests are too close in time","text":"Hi, I'm getting this error when I make a request close after another (not always, it's a range, not inmediate and not long after it):
\njava.lang.IllegalStateException: Connection 192.168.1.152:43204<->35.186.224.25:443 is still allocated\n at org.apache.hc.core5.util.Asserts.check(Asserts.java:50) ~[httpcore5-5.2.2.jar:5.2.2]\n at org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager.getConnection(BasicHttpClientConnectionManager.java:306) ~[httpclient5-5.2.1.jar:5.2.1]\n...\n
\nFrom what I read this happens when using the BasicHttpClientConnectionManager and having more than one request open, depending on timing it will reuse the connection on create a new one.
\nI'm making the calls using the synchronous execute, but using spring boot so executions are probably in different threads (I also tried with async calls and got the same issue).
\nIs there a way to avoid this (I may be using the API wrong)? Right now I have a wrokaround with a wrapper that catches the exception and retries, but asking in case there's a better way to handle this.
\nThanks
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"You're on the right track. You can try to use a pooling connection manager as httpManager by building a custom SpotifyApi instance.
","upvoteCount":1,"url":"https://github.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:992a29e1-eef7-d5d1-b038-7664205e7f79 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | AE1A:2A5781:57944:7341A:696F0FD5 |
| html-safe-nonce | b87ff16c2a167de2d4c8f0802ee6c0b645384915a93695d4d51a1bf1343c22d6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTFBOjJBNTc4MTo1Nzk0NDo3MzQxQTo2OTZGMEZENSIsInZpc2l0b3JfaWQiOiI4NDA1MjU5MzgzODE3MDQ4MDIxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d2bf1dee597242206bba49d59b1e0cbc8b05358109423262fb100718adc20bd6 |
| hovercard-subject-tag | discussion:5847938 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/spotify-web-api-java/spotify-web-api-java/367/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/9f3a0bbcc1ed594535982930842d602f10b53bceaff24a117d3d0d0c0fa84bf7/spotify-web-api-java/spotify-web-api-java/discussions/367 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f3a0bbcc1ed594535982930842d602f10b53bceaff24a117d3d0d0c0fa84bf7/spotify-web-api-java/spotify-web-api-java/discussions/367 |
| og:image:alt | Hi, I'm getting this error when I make a request close after another (not always, it's a range, not inmediate and not long after it): java.lang.IllegalStateException: Connection 192.168.1.152:43204... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/spotify-web-api-java/spotify-web-api-java git https://github.com/spotify-web-api-java/spotify-web-api-java.git |
| octolytics-dimension-user_id | 90800172 |
| octolytics-dimension-user_login | spotify-web-api-java |
| octolytics-dimension-repository_id | 18928344 |
| octolytics-dimension-repository_nwo | spotify-web-api-java/spotify-web-api-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18928344 |
| octolytics-dimension-repository_network_root_nwo | spotify-web-api-java/spotify-web-api-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width