New issue
Advanced search Search tips

Issue 8677 link

Starred by 1 user

Issue metadata

Status: Released
Owner:
Closed: Apr 2018
Components:



Sign in to add a comment

All PUT/POST REST-API with rawInput are broken in Gerrit v2.15

Project Member Reported by luca.mil...@gmail.com, Apr 2 2018

Issue description

*****************************************************************
*****                                                       *****
***** !!!! THIS BUG TRACKER IS FOR GERRIT CODE REVIEW !!!!  *****
*****                                                       *****
***** DO NOT SUBMIT BUGS FOR CHROME, ANDROID, CYANOGENMOD,  *****
***** INTERNAL ISSUES WITH YOUR COMPANY'S GERRIT SETUP, ETC.*****
*****                                                       *****
*****   THOSE ISSUES BELONG IN DIFFERENT ISSUE TRACKERS     *****
*****                                                       *****
*****************************************************************

Affected Version:

What steps will reproduce the problem?
1. Run Gerrit v2.15 with remote plugin management enabled
2. Execute the REST API http://localhost:8080/a/plugins/review-strategy.jar with payload '{"url":"https://gerrit-ci.gerritforge.com/job/plugin-review-strategy-bazel-master/2//artifact/bazel-genfiles/plugins/review-strategy/review-strategy-static.jar"}
'

What is the expected output?
HTTP status code 201 and the plugin 'review-strategy.jar' installed

What do you see instead?
HTTP status 500 and the following exception:
java.lang.IllegalStateException: READER
	at org.eclipse.jetty.server.Request.getInputStream(Request.java:844)
	at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:138)
	at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:138)
	at com.google.gerrit.httpd.restapi.RestApiServlet.consumeRawInputRequestBody(RestApiServlet.java:778)
	at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:406)


Please provide any additional information below.
This is broken in Gerrit v2.15 because of:
https://gerrit-review.googlesource.com/c/gerrit/+/100332/


 
Project Member

Comment 1 by jrn@google.com, Apr 2 2018

From https://groups.google.com/forum/#!topic/repo-discuss/vNsRp-nLloQ. Thanks for reporting it.

[2018-04-02 09:20:03,098] [HTTP-66] ERROR com.google.gerrit.httpd.restapi.RestApiServlet : Error in PUT /a/plugins/reviewers.jar
java.lang.IllegalStateException: READER
        at org.eclipse.jetty.server.Request.getInputStream(Request.java:844)
        at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:138)
        at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:138)

The relevant Jetty code

    public ServletInputStream getInputStream() throws IOException
    {
        if (_inputState != __NONE && _inputState != _STREAM)
            throw new IllegalStateException("READER");

This means getReader() has been called at some point previously, to set _inputState to READER. I think the simplest approach to fixing this will be to find out when.
Project Member

Comment 2 by jrn@google.com, Apr 2 2018

Status: ChangeUnderReview (was: New)
https://gerrit-review.googlesource.com/c/gerrit/+/169490
Project Member

Comment 3 by jrn@google.com, Apr 2 2018

Owner: masayasuzuki@google.com
Status: Accepted (was: ChangeUnderReview)
Project Member

Comment 4 by jrn@google.com, Apr 2 2018

Status: ChangeUnderReview (was: Accepted)
https://gerrit-review.googlesource.com/c/gerrit/+/169510
Project Member

Comment 5 by jrn@google.com, Apr 3 2018

Status: Submitted (was: ChangeUnderReview)
Fix submitted. A backport to stable-2.15 is in https://gerrit-review.googlesource.com/c/gerrit/+/169750.
Project Member

Comment 6 by luca.mil...@gmail.com, Apr 3 2018

Thanks for everyone's help and for the quick response and fix.
Project Member

Comment 7 by luca.mil...@gmail.com, Nov 20

Labels: FixedIn-2.16
Status: Released (was: Submitted)

Sign in to add a comment