René's URL Explorer Experiment


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

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@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):

\n
java.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
\n

From 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).

\n

Is 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.

\n

Thanks

","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-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:992a29e1-eef7-d5d1-b038-7664205e7f79
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idAE1A:2A5781:57944:7341A:696F0FD5
html-safe-nonceb87ff16c2a167de2d4c8f0802ee6c0b645384915a93695d4d51a1bf1343c22d6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTFBOjJBNTc4MTo1Nzk0NDo3MzQxQTo2OTZGMEZENSIsInZpc2l0b3JfaWQiOiI4NDA1MjU5MzgzODE3MDQ4MDIxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd2bf1dee597242206bba49d59b1e0cbc8b05358109423262fb100718adc20bd6
hovercard-subject-tagdiscussion:5847938
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/spotify-web-api-java/spotify-web-api-java/367/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/9f3a0bbcc1ed594535982930842d602f10b53bceaff24a117d3d0d0c0fa84bf7/spotify-web-api-java/spotify-web-api-java/discussions/367
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9f3a0bbcc1ed594535982930842d602f10b53bceaff24a117d3d0d0c0fa84bf7/spotify-web-api-java/spotify-web-api-java/discussions/367
og:image:altHi, 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:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee
turbo-cache-controlno-preview
go-importgithub.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_id90800172
octolytics-dimension-user_loginspotify-web-api-java
octolytics-dimension-repository_id18928344
octolytics-dimension-repository_nwospotify-web-api-java/spotify-web-api-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id18928344
octolytics-dimension-repository_network_root_nwospotify-web-api-java/spotify-web-api-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release39aed5006635ab6f45e6b77d23e73b08a00272a3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fspotify-web-api-java%2Fspotify-web-api-java%2Fdiscussions%2F367
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fspotify-web-api-java%2Fspotify-web-api-java%2Fdiscussions%2F367
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=spotify-web-api-java%2Fspotify-web-api-java
Reloadhttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
Reloadhttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
Reloadhttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
spotify-web-api-java https://patch-diff.githubusercontent.com/spotify-web-api-java
spotify-web-api-javahttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fspotify-web-api-java%2Fspotify-web-api-java
Fork 289 https://patch-diff.githubusercontent.com/login?return_to=%2Fspotify-web-api-java%2Fspotify-web-api-java
Star 1.1k https://patch-diff.githubusercontent.com/login?return_to=%2Fspotify-web-api-java%2Fspotify-web-api-java
Code https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java
Issues 0 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/issues
Pull requests 0 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/pulls
Discussions https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions
Actions https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/actions
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/security
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
Insights https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/pulse
Code https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java
Issues https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/issues
Pull requests https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/pulls
Discussions https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions
Actions https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/actions
Security https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/security
Insights https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/pulse
Answered https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730
dargmueslihttps://patch-diff.githubusercontent.com/dargmuesli
diego09310 https://patch-diff.githubusercontent.com/diego09310
Q&Ahttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/categories/q-a
Error when two requests are too close in time https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#top
diego09310 https://patch-diff.githubusercontent.com/diego09310
Answered https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730
dargmueslihttps://patch-diff.githubusercontent.com/dargmuesli
Return to tophttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#top
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
diego09310 https://patch-diff.githubusercontent.com/diego09310
Nov 13, 2023 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussion-5847938
Give feedback.https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
dargmuesli https://patch-diff.githubusercontent.com/dargmuesli
Nov 14, 2023 https://github.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730
use a pooling connection managerhttps://stackoverflow.com/a/14866394/4682621
building a custom SpotifyApi instancehttps://spotify-web-api-java.github.io/spotify-web-api-java/se/michaelthelin/spotify/SpotifyApi.Builder.html
View full answer https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730
Oldest https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367?sort=old
Newest https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367?sort=new
Top https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367?sort=top
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
dargmuesli https://patch-diff.githubusercontent.com/dargmuesli
Nov 14, 2023 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7560730
use a pooling connection managerhttps://stackoverflow.com/a/14866394/4682621
building a custom SpotifyApi instancehttps://spotify-web-api-java.github.io/spotify-web-api-java/se/michaelthelin/spotify/SpotifyApi.Builder.html
Give feedback.https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/diego09310
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
diego09310https://patch-diff.githubusercontent.com/diego09310
Dec 4, 2023 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7758431
Give feedback.https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/dargmuesli
Please reload this pagehttps://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
dargmueslihttps://patch-diff.githubusercontent.com/dargmuesli
Dec 4, 2023 https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367#discussioncomment-7758676
#375https://github.com/spotify-web-api-java/spotify-web-api-java/pull/375
Give feedback.https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
diego09310https://patch-diff.githubusercontent.com/diego09310
Sign up for freehttps://patch-diff.githubusercontent.com/join?source=comment-repo
Sign in to commenthttps://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fspotify-web-api-java%2Fspotify-web-api-java%2Fdiscussions%2F367
🙏 Q&A https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/categories/q-a
https://patch-diff.githubusercontent.com/diego09310
https://patch-diff.githubusercontent.com/dargmuesli
https://patch-diff.githubusercontent.com/spotify-web-api-java/spotify-web-api-java/discussions/367
https://patch-diff.githubusercontent.com/settings/replies?return_to=1
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.