Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cURL error : 23 #4101

Open
sal0max opened this issue May 12, 2024 · 9 comments
Open

cURL error : 23 #4101

sal0max opened this issue May 12, 2024 · 9 comments
Labels
Bug-Report Confirmed bug report

Comments

@sal0max
Copy link
Contributor

sal0max commented May 12, 2024

Describe the bug
Since quite some time (2024-04-04), ExplosmBridge doesn't work any more. However, I suspect the reason being somewhere in the rss-bridge libs. This is the error I get:

-- Details
Type: HttpException
Code: 0
Message: cURL error : 23 (https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://explosm.net/comics/latest#comic
File: lib/http.php
Line: 154

-- Trace
#0 index.php(72): RssBridge->main()
#1 lib/RssBridge.php(103): DisplayAction->execute()
#2 actions/DisplayAction.php(65): DisplayAction->createResponse()
#3 actions/DisplayAction.php(114): ExplosmBridge->collectData()
#4 bridges/ExplosmBridge.php(36): getSimpleHTMLDOM()
#5 lib/contents.php(164): getContents()
#6 lib/contents.php(85): CurlHttpClient->request()
#7 lib/http.php(154)

-- Context
Query: action=display&bridge=ExplosmBridge&limit=5&format=Html
Version: 2024-02-02 (git.master.1c3024f)
OS: Linux
PHP: 8.1.28 

To Reproduce
Steps to reproduce the behavior:
Add ExpolsmBridge and try to get the feed.

Expected behavior
Getting the feed.

@sal0max sal0max added the Bug-Report Confirmed bug report label May 12, 2024
@dvikan
Copy link
Contributor

dvikan commented May 12, 2024

CURLE_WRITE_ERROR (23)

An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback. 

full disk?

read-only fs?

@sal0max
Copy link
Contributor Author

sal0max commented May 13, 2024

Yeah... the error message baffles me, too.

No, all other bridges run flawlessly.

@dvikan
Copy link
Contributor

dvikan commented May 13, 2024

the explosm bridge caches for 2 hours. you are probably seeing a cache result?

or does the error continue to persist?

if error is only for explosm it is very strange.

TLDR: libcurl is unable to write to fs

@sal0max
Copy link
Contributor Author

sal0max commented May 13, 2024

I tested some stuff and in that process set the cache time to 0. And as mentioned: The problem exists since 2024-04-04.

At first, I thought the error is due to changes on the website. It seems, that the CSS selectors wouldn't work any more, as classes have changed. But the error message clearly states to look in lib/http.php.

@dvikan
Copy link
Contributor

dvikan commented May 13, 2024

the stack trace has this message:

Message: cURL error : 23 

there is a curl error message missing here. did you modify it?

rss-bridge throws like this:

            $curl_error = curl_error($ch);
            $curl_errno = curl_errno($ch);
            throw new HttpException(sprintf(
                'cURL error %s: %s (%s) for %s',
                $curl_error,
                $curl_errno,
                'https://curl.haxx.se/libcurl/c/libcurl-errors.html',
                $url
            ));

anyways i think problem is in curl_setopt($ch, CURLOPT_HEADERFUNCTION which returns 0 due to bug in rss-bridge.

@dvikan
Copy link
Contributor

dvikan commented May 13, 2024

if you are able to reproduce you can try this patch:

diff --git a/lib/http.php b/lib/http.php
index 39f0c727..0c8a3896 100644
--- a/lib/http.php
+++ b/lib/http.php
@@ -116,6 +116,9 @@ final class CurlHttpClient implements HttpClient
         $responseHeaders = [];
         curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($ch, $rawHeader) use (&$responseHeaders, &$responseStatusLines) {
             $len = strlen($rawHeader);
+            if ($len === 0) {
+                throw new \Exception('wtf? ' . $rawHeader);
+            }
             if ($rawHeader === "\r\n") {
                 return $len;
             }

@sal0max
Copy link
Contributor Author

sal0max commented May 13, 2024

I tried the patch, but the if-clause doesn't catch. Still the same error message:

Message: cURL error : 23 (https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://explosm.net/comics/latest#comic 

I removed the if-clause and just threw the Exception. Result:

Message: wtf? HTTP/2 307 

@dvikan
Copy link
Contributor

dvikan commented Jun 18, 2024

did u ever find the mysterious source of this bug

@sal0max
Copy link
Contributor Author

sal0max commented Jun 21, 2024

It still occurs with every call of that source. But I didn't find time yet to investigate the issue, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug-Report Confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants