mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-26 23:45:49 +03:00
[GH-ISSUE #238] cURL transport error: 28 Failed to connect #169
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#169
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dinandmentink on GitHub (Nov 20, 2021).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/238
I have a small personal application which I use to connect to spotify. It's fairly simple, I run it locally.
However, sometimes™, sending any request to the SpotifyWebAPI will result in the process hanging for rougly 30 seconds, after which I get the following error:
I don't think there's an issue with access/refresh tokens, those are handled and any error in the access token causes a raise like I would expect.
I also don't think there's a rate limit, because I'm not receiving 429 errors, just a timeout.
I would personally be fine if curl just returned an error after a timeout of 1 second. But for some reason setting curlopts doesn't cause a timeout any faster than the 60 seconds I'm now seeing.
Anyone experience with this? Am I missing something? This is roughly my implementation:
(and then using
spotify()->me()and such in the application).@jwilsson commented on GitHub (Nov 21, 2021):
Hey!
That's strange. How are you setting the cURL options? Via the
curl_optionssetting?@dinandmentink commented on GitHub (Nov 21, 2021):
Yes, like that.
@jwilsson commented on GitHub (Nov 21, 2021):
I forgot to ask you in the last comment, which timeout option are you using?
CURLOPT_CONNECTTIMEOUT,CURLOPT_TIMEOUT, or both?@dinandmentink commented on GitHub (Nov 21, 2021):
I have tried multiple approaches. Both
CURLOPT_CONNECTTIMEOUTandCURLOPT_TIMEOUTand both. It almost seems that a timeout isn't registered by PHP, or something.@jwilsson commented on GitHub (Nov 22, 2021):
Hmm, that sounds really weird. But I'm afraid I can't be of much help, I've never encountered this error myself. I do know of a few people who have posted about similar cURL issues here over the years but we've never really been able to find the root cause.
I'll leave this issue open for a while to see if someone else might has the same problem and have a solution for it.
@dinandmentink commented on GitHub (Nov 23, 2021):
Ok. Thanks for your response. At the moment I am using the php dev server
php -Sas a server. I'll migrate this to a simple lighttp/apache/nginx server to see if it helps.@dinandmentink commented on GitHub (Dec 11, 2021):
Update: I have migrated my app to a lighttp webserver using php through fastcgi. Still the same issue. Tried it both in ubuntu 20.04 and 21.10, but no luck.
@jwilsson commented on GitHub (Dec 14, 2021):
Hmm, and you're not behind a proxy, firewall, or similar?
@dinandmentink commented on GitHub (Dec 14, 2021):
No I'm not.
It seems, however, I have fixed the issue where curl timeouts did not trigger. After carefully checking my work against
github.com/jwilsson/spotify-web-api-php@646b49a104/docs/examples/setting-custom-curl-options.mdI realized a request (with curl options) needs to be set both for theSessionand theSpotifyWebAPI. After amending this now I, at least, get a curl timeout error after a reasonable few seconds instead of a minute. So for me this works, for now.Edit: if anyone has the same issue I'll be happy to have a look, but for me it seems to work now. Thanks for your responses and input!