Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(73)

Issue 1854041: Fix weird 'EOF Exception' coming from JDK ZLIB input Stream (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 8 months ago by vikaas.arora
Modified:
15 years, 6 months ago
Reviewers:
johnfargo, shindig.remailer
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk
Visibility:
Public.

Description

Due to JDK bug (Ref: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4040920), the 'EOF Exception' comes while accessing zip content. This issue is very inconsistent and happens for some zip resources and that too once in 4-5 times. This is little hard to reproduce but when it comes, it comes for wrong case/reason, even though the resource itself is fetched fine. Refer the bug link, mentioned above. The bug lies in the JDK 'Inflater.finished()' call, that erroneously returns 'false' even if the input stream (zip) is done reading the response. Whenever this happens, 'java.util.zip.InflaterInputStream.fill' will throw the 'EOFException'. As a fix for this specific corner case, ignore the Exception (EOF with specific cause trail) and let pass all other exceptions. I verified this working OK on the site for which this error was initially reported. The change is trivial. I am getting soem issues in writing the appropriate Unit Test case for the same. Once the change looks OK to be submitted, will invest more time in writing the Unit Testcase for the same.

Patch Set 1 #

Total comments: 3

Patch Set 2 : Fixed space formatting #

Total comments: 2

Patch Set 3 : Added John & Ziv to reviewers. Retained the '(entity == null)' check in method 'makeResponse' #

Total comments: 2

Patch Set 4 : Anupama's feedback #

Total comments: 4

Patch Set 5 : Addressed Fargo's comment (UT under way though) #

Patch Set 6 : unit Test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+167 lines, -5 lines) Patch
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java View 1 2 3 4 5 2 chunks +64 lines, -1 line 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/http/BasicHttpFetcherTest.java View 2 chunks +103 lines, -4 lines 0 comments Download

Messages

Total messages: 20
vikaas.arora
15 years, 8 months ago (2010-07-15 10:59:36 UTC) #1
gagan.goku
http://codereview.appspot.com/1854041/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/1/2#newcode502 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:502: } catch (EOFException eofe) { cant we simply enclose ...
15 years, 8 months ago (2010-07-15 13:01:18 UTC) #2
gagan.goku
On 2010/07/15 13:01:18, gagan.goku wrote: > http://codereview.appspot.com/1854041/diff/1/2 > File > java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java > (right): > > ...
15 years, 8 months ago (2010-07-15 13:04:17 UTC) #3
vikaas.arora
http://codereview.appspot.com/1854041/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/1/2#newcode502 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:502: } catch (EOFException eofe) { On 2010/07/15 13:01:18, gagan.goku ...
15 years, 8 months ago (2010-07-15 14:25:17 UTC) #4
gagan.goku
http://codereview.appspot.com/1854041/diff/1/2 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/1/2#newcode502 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:502: } catch (EOFException eofe) { On 2010/07/15 14:25:17, vikaas.arora ...
15 years, 8 months ago (2010-07-15 19:04:50 UTC) #5
vikaas.arora
Fixed space formatting
15 years, 8 months ago (2010-07-16 12:44:58 UTC) #6
anupama.dutta
http://codereview.appspot.com/1854041/diff/8001/9001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (left): http://codereview.appspot.com/1854041/diff/8001/9001#oldcode461 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:461: byte[] responseBytes = (entity == null) ? null : ...
15 years, 8 months ago (2010-07-19 02:50:53 UTC) #7
vikaas.arora
http://codereview.appspot.com/1854041/diff/8001/9001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (left): http://codereview.appspot.com/1854041/diff/8001/9001#oldcode461 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:461: byte[] responseBytes = (entity == null) ? null : ...
15 years, 8 months ago (2010-07-19 03:24:23 UTC) #8
vikaas.arora
Added John & Ziv to reviewers. Retained the '(entity == null)' check in method 'makeResponse'
15 years, 8 months ago (2010-07-19 03:45:56 UTC) #9
anupama.dutta
http://codereview.appspot.com/1854041/diff/14001/15001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/14001/15001#newcode482 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:482: if (entity != null) { To reduce indentation, you ...
15 years, 8 months ago (2010-07-19 05:12:35 UTC) #10
vikaas.arora
Anupama's feedback
15 years, 8 months ago (2010-07-19 06:36:32 UTC) #11
vikaas.arora
http://codereview.appspot.com/1854041/diff/14001/15001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/14001/15001#newcode482 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:482: if (entity != null) { On 2010/07/19 05:12:36, anupama.dutta ...
15 years, 8 months ago (2010-07-19 06:37:51 UTC) #12
johnfargo
Hi Vikas: Very tricky, and strange, situation! The fix seems reasonable to me. My two ...
15 years, 8 months ago (2010-07-19 17:34:01 UTC) #13
vikaas.arora
http://codereview.appspot.com/1854041/diff/18001/19001 File java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (right): http://codereview.appspot.com/1854041/diff/18001/19001#newcode480 java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java:480: private byte[] toByteArraySafe(final HttpEntity entity) throws IOException { On ...
15 years, 8 months ago (2010-07-20 13:30:29 UTC) #14
vikaas.arora
Addressed Fargo's comment (UT under way though)
15 years, 8 months ago (2010-07-20 13:32:55 UTC) #15
johnfargo
Vikas: Thanks for the thorough explanation, and the accommodation of your observations based on this. ...
15 years, 8 months ago (2010-07-20 20:19:26 UTC) #16
vikaas.arora
Added a unit test
15 years, 8 months ago (2010-07-21 06:49:10 UTC) #17
vikaas.arora
unit Test
15 years, 8 months ago (2010-07-21 07:10:33 UTC) #18
johnfargo
Looks good, Vikas. I'm still a little leery of disambiguating this use case based on ...
15 years, 8 months ago (2010-07-21 09:55:18 UTC) #19
vikaas.arora
15 years, 8 months ago (2010-07-21 10:10:49 UTC) #20
Thanks for committing the fix

Given the corner case and inconsistent exception trigger, the check that we had
was very stringent. As you mentioned, if the conditions that are set are not
violated and still there's an issue (exception), worst case the
exception will again
be thrown. So in any case, it won't be worst than the existing behavior.

-Vikas

On Wed, Jul 21, 2010 at 3:25 PM,  <johnfargo@gmail.com> wrote:
> Looks good, Vikas. I'm still a little leery of disambiguating this use
> case based on the String of its error condition, but I understand the
> rationale (and the worst that could happen is that this particular fix
> doesn't trigger, which is status quo).
>
> Committed!
>
> On 2010/07/21 07:10:33, vikaas.arora wrote:
>>
>> unit Test
>
>
>
> http://codereview.appspot.com/1854041/show
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b