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
osc user authentification seems to be broken with last commit #202
Comments
Hmm I cannot reproduce this:
marcus@linux:~> osc meta prjconf home:Marcus_H > prjconf
marcus@linux:~> echo >> prjconf
marcus@linux:~> osc meta prjconf home:Marcus_H -F prjconf
Sending meta data...
Done.
marcus@linux:~>
Can you post the output of
"osc -d -c ~/testobsadmin.rc meta prjconf Test10 -F newprjconf"?
|
I can reproduce this:
returns: `Sending meta data... Request: https://api.openlifecyclemanager.com/source/OBS%3ATools%3AUnstable/_meta while the git commit 8466e49 works. |
I checked with git commit c53a768 , which returns this error. |
Still happens with git commit 502dbaa the current git master. |
On 2016-05-29 11:15:45 -0700, Martin Mohring wrote:
|
osc.txt I can confirm, that it seems to still work with opensuse.org, maybe thats because of the ichain/proxy auth. The error on the OBS server is (production.log): |
On 2016-05-29 23:43:25 -0700, Karsten Keil wrote:
|
osc_d_h_fail.txt |
@mmohring is the 500 reproducable? In that case I would be interessted in the backtrace of the api. (no client should be able to create this) |
@adrianschroeter Will make a log and put it here. Will try with my local OBS and b.o.o. |
@adrian yes I see the 500 too, but here is no back trace in the production.log, only what I wrote in the comment above. in the access log I see the 500: |
On 2016-05-30 02:10:35 -0700, Karsten Keil wrote:
osc_d_h_fail.txt: indicates that the correct codepath is used (in this case). I'll try to reproduce with a local obs instance (as soon as I have it |
First of all the check with b.o.o.
So this works. |
I am using openSUSE 13.2 x86_64 as a host for OBS Unstable. Installed git master from git commit 54314f6e74235292a0de902534a1cba5993b1beb , e.g. from Friday. As I said osc git commit c53a768 was when it started not working. |
I will test openSUSE/open-build-service#1840 . |
I have tested openSUSE/open-build-service#1840 , still the same results. |
1840 is unrelated to this issue |
OK. Anyway, I have tried to accidentially make a osc ci with also an internal 500 error:
and this resulted also in an error: |
@marcus-h: I tried this against the last unstable appliance (obs-server qcow2 image), same results. |
This reverts commit c53a768 (for now!). It seems to break local obs instances (see issue #202) (this needs further debugging). Moreover, it breaks the python 3.4 - excerpt from a travis run: ====================================================================== ERROR: test_added_missing2 (test_commit.TestCommit) ---------------------------------------------------------------------- Traceback (most recent call last): File "/opt/python/3.4.2/lib/python3.4/urllib/request.py", line 1111, in do_request_ mv = memoryview(data) TypeError: memoryview: _io.BufferedReader object does not have the buffer interface During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/travis/build/openSUSE/osc/tests/common.py", line 122, in wrapped_test_method test_method(*args) File "/home/travis/build/openSUSE/osc/tests/common.py", line 122, in wrapped_test_method test_method(*args) File "/home/travis/build/openSUSE/osc/tests/common.py", line 122, in wrapped_test_method test_method(*args) File "/home/travis/build/openSUSE/osc/tests/common.py", line 122, in wrapped_test_method test_method(*args) File "/home/travis/build/openSUSE/osc/tests/common.py", line 122, in wrapped_test_method test_method(*args) File "/home/travis/build/openSUSE/osc/tests/test_commit.py", line 290, in test_added_missing2 p.commit() File "/home/travis/build/openSUSE/osc/tests/osc/core.py", line 1471, in commit self.put_source_file(filename, tdir) File "/home/travis/build/openSUSE/osc/tests/osc/core.py", line 1319, in put_source_file http_PUT(u, file = tfilename) File "/home/travis/build/openSUSE/osc/tests/osc/core.py", line 3243, in http_PUT def http_PUT(*args, **kwargs): return http_request('PUT', *args, **kwargs) File "/home/travis/build/openSUSE/osc/tests/osc/core.py", line 3231, in http_request fd = urlopen(req, data=data) File "/opt/python/3.4.2/lib/python3.4/urllib/request.py", line 153, in urlopen return opener.open(url, data, timeout) File "/opt/python/3.4.2/lib/python3.4/urllib/request.py", line 453, in open req = meth(req) File "/opt/python/3.4.2/lib/python3.4/urllib/request.py", line 1116, in do_request_ data)) ValueError: Content-Length should be specified for iterable data of type <class '_io.BufferedReader'> <_io.BufferedReader name='/tmp/osc_test571whun4/osctest/added_missing/.osc/_in_commit/bar'>
On 2016-06-01 05:13:36 -0700, Karsten Keil wrote:
|
Is this still broken? |
The old code only supports a file whose size is less then or equal to INT_MAX (due to a reasonable(!) limit in M2Crypto). The actual issue is in core.http_request which mmap(...)s the file, wraps it into a memoryview/buffer and then passes the memoryview/buffer to urlopen. Eventually, the whole memoryview/buffer is read into memory (see m2_PyObject_GetBufferInt). If the file is too large (> INT_MAX), m2_PyObject_GetBufferInt raises a ValueError (which is perfectly fine!). Reading a whole file into memory is completely insane. In order to avoid this, we now simply pass a file-like object to urlopen (more precisely, the file-like object is associated with the Request instance that is passed to urlopen). The advantange is that the file-like object is processed in chunks of 8192 bytes (see http.client.HTTPConnection) (that is, only 8192 bytes are read into memory (instead of the whole file)). There are two pitfalls when passing a file-like object to urlopen: * By default, a chunked Transfer-Encoding is applied. It seems that some servers (like api.o.o) do like this (PUTing a file with a chunked Transfer-Encoding to api.o.o results in status 400). In order to avoid a chunked Transfer-Encoding, we explicitly set a Content-Length header (we also do this in the non-file case (just for the sake of completeness)). * If the request fails with status 401, it is retried with an appropriate Authorization header. When retrying the request, the file's offset has to be repositioned to the beginning of the file (otherwise, a 0-length body is sent which most likely does not match the Content-Length header). Note: core.http_request's "data" and "file" parameters are now mutually exclusive because specifying both makes no sense (only one of them is considered) and it simplifies the implementation a bit. Fixes: openSUSE#202 ("osc user authentification seems to be broken with last commit") Fixes: openSUSE#304 ("osc ci - cannot handle more than 2 GB file uploads")
with current master for example this does not longer work
`osc -c ~/testobsadmin.rc meta prjconf Test10 -F newprjconf
Sending meta data...
Server returned an error: HTTP Error 500: Internal Server Error
Request: https://api.linux-pingi.de/source/Test10/_config
Headers:
content-language: en
accept-ranges: bytes
vary: accept-language,accept-charset
server: Apache
connection: close
cache-control: public
date: Sat, 28 May 2016 10:42:35 GMT
content-type: text/html; charset=utf-8
`
Same command with 0.154.0 works, a quick bisect found
c53a7681 as reason.
The text was updated successfully, but these errors were encountered: