-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Cannot modify header information (Sapi.php:132) NC 19.0.2 #22509
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It's back again after upgrade to 19.0.3. The number after hash in the log message has changed from 680 to 683.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
By reverting client to 2.6.5 the sync works again. Avoid client 3.x for now. |
Same error in 19.0.3, even uploading via browser is not working... I did little research, i can upload really smal files some kb, but imgaes some mb are not possible.... |
Same error in Nextcloud 19.0.3. Uploading small text file in browser to WedDav external store is not working. I found workaround that worked for me for the webclient. I removed my DropboxV2 external storage and removed the external dir of the WebDav storage. Now it works (both in the ios app and in the webclient). |
With Nextcloud 19.0.4 the situation does not change. Only one line number is different in the error message (#683 -> #690) |
This comment has been minimized.
This comment has been minimized.
Same here. I did a fresh Nextcloud 20.0.0 installation and I get the following, if I upload a file to a shared folder through a shared link:
But I can upload without issues, if I login with my user account. |
It's not a solution, but it is something.. I had the same error since I made an update to 19.0.3. But now the error is gone, after I changed the local network. I don't know how this affects anything, all I know is, that the working network has a better upstream (downstream is equal). I couldn't check yet if it still fails with this error in the other network, but maybe I can test later and will report interesting results. |
I'm still trying to find solutions. Everything worked well with the 18.0.x then, from 19.0.3 onwards I can only upload files of less than 1.5 MB. This is as much with the Android/iOS client as it is with the browser. What puzzles me is that I can easily load 1 GB files if I use oClud.de |
Same problem with 19.0.4 here, using client version 3.0.2 on Windows. No problems at all when uploading files through the web interface. |
I had the same issue (NC 19.0.4) |
Here is a full stack trace, maybe that helps in understanding the underlying issue. In this case it was triggered by an upload from the Android app: {
"reqId": "vMp9gJTkQ9DTydtEtHBm",
"level": 3,
"time": "2020-10-16T23:20:17+02:00",
"remoteAddr": "111.222.333.444",
"user": "theuser",
"app": "PHP",
"method": "PUT",
"url": "/remote.php/dav/uploads/theuser/35596bf55d30b13fda6d265b8f116e16/0000000000000000-0000000002351377",
"message": {
"Exception": "Error",
"Message": "Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php#690",
"Code": 0,
"Trace": [{
"function": "onError",
"class": "OC\\Log\\ErrorHandler",
"type": "::",
"args": [2, "Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132)", "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php", 690, {
"string": "X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"
}]
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 690,
"function": "header",
"args": ["X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"]
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",
"line": 188,
"function": "header",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": ["X-Hash-MD5: 4cb41cb7e045d80a78da4789ee637ede"]
}, {
"function": "OCA\\DAV\\Connector\\Sabre\\{closure}",
"class": "OCA\\DAV\\Connector\\Sabre\\File",
"type": "->",
"args": ["*** sensitive parameters replaced ***"]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 71,
"function": "call_user_func",
"args": [{
"__class__": "Closure"
}, "*** sensitive parameter replaced ***"]
}, {
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
"line": 132,
"function": "fclose",
"args": [null]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
}, {
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php",
"line": 132,
"function": "fclose",
"args": [null]
}, {
"file": "/var/www/nextcloud/lib/private/Files/Stream/HashWrapper.php",
"line": 75,
"function": "stream_close",
"class": "Icewind\\Streams\\Wrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",
"line": 319,
"function": "stream_close",
"class": "OC\\Files\\Stream\\HashWrapper",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/apps/dav/lib/Server.php",
"line": 320,
"function": "exec",
"class": "Sabre\\DAV\\Server",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",
"line": 35,
"function": "exec",
"class": "OCA\\DAV\\Server",
"type": "->",
"args": []
}, {
"file": "/var/www/nextcloud/remote.php",
"line": 167,
"args": ["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],
"function": "require_once"
}],
"File": "/var/www/nextcloud/lib/private/Log/ErrorHandler.php",
"Line": 91,
"CustomMessage": "--"
},
"userAgent": "Mozilla/5.0 (Android) Nextcloud-android/3.13.1",
"version": "19.0.4.2",
"id": "5f8b113f613e3" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I was able to fix it on my installation by manually apply some changes. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm getting the same error( 20.0.9) ,I saw many people locate the tmp_dir which inspired me.So i checked out my tmp_dir and found that my permissions were satisfied but not enough space.So I clean up the tmp directory.Yeeeees, that seems to work for me. |
Hello there! I am experiencing the same issue with snap Nextcloud version 21.0.1snap2 running on Ubuntu 18LTS. From the logs I can see: <> The lastest updates are installed (OS & snap). BR |
Another cause for this seems to be insufficient permissions. Folder that I tried to write to, was not writable by Better error messages would be appreciated. |
I believe it's important to note that the error message "Cannot modify header information - headers already sent by ..." clearly indicates that the error is produced by code that isn't exactly broken. Rather, the broken code ran earlier and produced the "headers already sent." What's broken is: The error produced by that earlier code is not recorded, and processing is allowed to continue until our secondary error message is produced. For months, I've been meaning to do the work to consistently reproduce this problem, then dig into the code to find the code that caused the earlier error. I haven't done that, because I keep hoping one of the Nextcloud developers will take the time to do it. I'm sure a developer more familiar with the Nextcloud code can do it more quickly than I can. I post this comment in the hope that it saves other Nextcloud users a bit of time: Many folks have generously taken the time to find workarounds and post them here. Several different workarounds, and I'm sure each works in a specific situation. But don't be discouraged if they don't work for you, because various un-caught errors trigger this secondary error, I believe. Finally, I acknowledge that I may be wrong about this "secondary error" thing. It's based on my experience with PHP, not on any specific investigation of this Nextcloud error. |
For my install, the problem was the |
Is this Issue still valid in NC21.0.4? If not, please close this issue. Thanks! :) |
It seems to be gone in 21.0.3. Thank you. |
The issue is stil valid in NC22.1.0 |
I haven't seen the error for a long time in my installation. But OK, reopened. Can anyone else confirm the issue in 21.0.3 or later? |
This comment has been minimized.
This comment has been minimized.
Can confirm the issue persists on 21.0.3 This issue on my server is seemingly only caused by iOS clients (via Nextcloud iOS app, auto upload). I think a few of these errors were generated by Android devices, but perhaps they actually dropped internet connections mid upload as it's extremely rare. Can also confirm this error is not generated by using the browser to upload files (at least with Firefox and Chrome on Windows machines). It also seems that after an iOS device fails to upload more than a few files it stops auto syncing. This might be a fluke, but it seems that on my server that this error rate is much lower with chunking set to the default 10mb, previously I ran 0 which increased upload speeds to my spinning rust main storage. Edit: Not sure why the comment above is marked as off-topic. The error we're discussing is always accompanied by the filesize error. |
Although I can't say that this behaviour comes from specific files, I also encountered a series of multiple errors. When I just restarted the sync, there was a series of six errors: #2-3: #4-6: "Error: Cannot modify header information - headers already sent by (output started at /volume1/web/nextcloud/3rdparty/sabre/http/lib/Sapi.php:132) at /volume1/web/nextcloud/apps/dav/lib/Connector/Sabre/File.php#693" I never recognized the file name too long error before. Maybe that is one source that afterwards leads to the header info failure message. |
Here's a filesize error created by an Android device, however there wasn't a "Cannot modify header information" error like before. Perhaps this is why someone here thought the issue was fixed? Perhaps the core issue of why files fail to upload is not related to the error we're discussing? Also I haven't yet encountered a "File name too long" error.
|
I believe we can close this ticket, as far as I understand the situation this error always appears when a Sabre endpoint received a malformed request, e.g. because the client went away and the connection broke. The relevant code is here: which is triggered further up: $contentLength = $response->getHeader('Content-Length');
if (null !== $contentLength) {
// ...
} else {
file_put_contents('php://output', $body);
} So whenever the body of a response is not empty but somehow the content length is, the code attempts to simply dump the output onto the PHP stream - which fails because of a previously and already reported error. I'm not versed enough in PHP to tell whether a } elseif (!headers_sent()) {
file_put_contents('php://output', $body);
} would prevent this error while not breaking things. 🤷♂️ |
@simonspa The issue is that clients on good connections, even on LAN in my case, fail to upload files small and large alike and in the case of iOS - auto sync breaks and stops uploading after encountering these errors. There are circumstances where your thesis is correct, but this behavior happens regardless of connection health and seemingly effects iOS/Mac devices more than Windows/Android, at least in my experience. I've yet to encounter this type of error from an Android device on LAN, but iOS devices struggle and for the most part consistently fail to upload files. |
In my case I fixed it by modifying the php settings, the error is gone and we can upload.17:25, August 12, 2021, Mazvydas ***@***.***>:
@simonspa The issue is that clients on good connections, even on LAN in my case, fail to upload files small and large alike and in the case of iOS - auto sync breaks and stops uploading after encountering these errors.
There are circumstances where your thesis is correct, but this behavior happens regardless of connection health and seemingly effects iOS/Mac devices more than Windows/Android, at least in my experience. I've yet to encounter this type of error from an Android device on LAN, but iOS devices struggle and for the most part consistently fail to upload files.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Right, but that would still point to a problem further up in the stack rather than PHP code - or am I mistaken? |
Your guess is as good as mine :) From my sample size it appears that iOS/MacOS devices encounter this specific issue much more frequently than other devices. Perhaps the core of this issue lies with those apps, libs they use or the OS architecture in general. However it could also be more to do with the way PHP/Nextcloud deal with incoming data. However I haven't encountered an issue with specifically iOS/MacOS devices failing to upload files via PHP, ever. My money is either on Nextcloud Server or iOS/MacOS Nextcloud apps. Edit: I'm also not running Nextcloud and any of it's dependencies (Apache, PHP, etc.) behind proxies or in containers, thus I'm ruling out that aspect of Nextcloud Server. |
In our case it only happened with specific files, independently of the OS used to upload them.The way it's configured by default isn't great. 18:03, August 12, 2021, Mazvydas ***@***.***>:
Right, but that would still point to a problem further up in the stack rather than PHP code - or am I mistaken?
Your guess is as good as mine :) From my sample size it appears that iOS/MacOS devices encounter this specific issue much more frequently than other devices. Perhaps the core of this issue lies with those apps, libs they use or the OS architecture in general.
However it could also be more to do with the way PHP/Nextcloud deal with incoming data. However I haven't encountered an issue with specifically iOS/MacOS devices failing to upload files via PHP, ever. My money is either on Nextcloud Server or iOS/MacOS Nextcloud apps.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Would you share what configuration changes you've made that eliminated this issue? |
I would but I'm on holidays and I don't have access to the exact changes right now😅.However I can tell you that I used these instructions:https://www.c-rieger.de/nextcloud-und-php-troubleshooting/What you have to do varies depending on the size of your server anyways.18:26, August 12, 2021, Mazvydas ***@***.***>:
In our case it only happened with specific files, independently of the OS used to upload them.The way it's configured by default isn't great.
Would you share what configuration changes you've made that eliminated this issue?
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Yes, as I wrote earlier, "cannot modify header information" is typically a secondary error. The primary error caused some output to the HTML response body, so PHP is letting us know we can't send headers anymore. I regret I never dug in to find that primary error, and I'm still running an older version of Nextcloud, so even if I find the primary error in that version, that info not apply to current versions. I hope this comment isn't a waste of everyone's time. I hope it leads a more knowledgeable Nextcloud developer to try to reprouce the error in a current version and track down the primary error. If they have time. Or, if nobody is seeing "cannot modify header information" in a current version, or if we're confident the primary error was found and fixed, then this ticket should be closed. |
I support @sbw, seeing it as a secondary error. In my case, the "cannot modify header information" always occured together with another error. However, sometimes the primary error was unfortunately not visible in the log (e.g. upload timed out due to slow database performance). |
Let's close this as a secondary error, fired only because another error has been fire previously (like, but not only, an aborted upload, failed to assembling chunkks, etc.). If you face this error, please report the main error in a new issue. |
How to use GitHub
Steps to reproduce
Upgrade to NC 19.0.2.
Expected behaviour
No PHP errors in the log.
Actual behaviour
Since upgrade to 19.0.2 many error messages like this in the log:
Server configuration
Operating system:
Ubuntu 18.04.5 LTS
Web server:
nginx version: nginx/1.19.2
Database:
MariaDB 10.1.44
PHP version:
7.2.33 (PHP 7.2.33-1+ubuntu18.04.1+deb.sury.org+1)
Nextcloud version:
19.0.2
Updated from an older Nextcloud/ownCloud or fresh install:
Updated from 18.0.8
Where did you install Nextcloud from:
Web admin update
Signing status:
Signing status
List of activated apps:
App list
Nextcloud configuration:
Config report
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser:
Operating system:
Logs
Web server error log
Web server error log
Nextcloud log (data/nextcloud.log)
Nextcloud log
Similar messages repeated many times:Browser log
Browser log
The text was updated successfully, but these errors were encountered: