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

Cause & solution for "inflater has been closed" exceptions found? #286

Open
Gintasz opened this issue Jul 13, 2017 · 6 comments
Open

Cause & solution for "inflater has been closed" exceptions found? #286

Gintasz opened this issue Jul 13, 2017 · 6 comments
Labels

Comments

@Gintasz
Copy link

Gintasz commented Jul 13, 2017

I can't pinpoint the problem, but literally, one launch it's working 100% fine 10/10 no problem, 2nd launch (no code change) I get random "Inflater has been closed" exceptions. Anyone experienced it? Would love to keep using jBrowserDriver, but I gotta fix this

@Gintasz
Copy link
Author

Gintasz commented Jul 13, 2017

Might be a coincidence, but it seems to occur less when Connection: keep-alive header is removed? I remove it with Settings.builder().requestHeaders() by passing default CHROME ones but with "Connection" header removed. I'm also using a proxy.

edit: fake news

@Gintasz
Copy link
Author

Gintasz commented Jul 13, 2017

FOUND IT!
I just did ~50 tries/launches with and without Connection header in main thread, separate thread, all worked 100% fine. Then I started cleaning up code, removed these lines:

Settings settings = Settings.builder()
                .proxy(new ProxyConfig(ProxyConfig.Type.HTTP, "hidden", 4444, "hidden", "hidden"))
                .userAgent(UserAgent.CHROME)
//                .socketTimeout(15000) // this
//                .connectTimeout(10000) // this
//                .connectionReqTimeout(5000) // this
//                .ajaxResourceTimeout(15000) // this
                .build();

and it immediatelly started crashing, only 2/10 succeeded. Literally, these timeout settings somehow fix the whole problem.

P. S. I'm testing with URL "https://accounts.google.com/signin/v2"

@hollingsworthd

@Gintasz Gintasz changed the title What is this randomness with "inflater has been closed" exceptions? Cause & solution for "inflater has been closed" exceptions found? Jul 13, 2017
@hollingsworthd
Copy link
Owner

This has been a longstanding issue and your info provides some excellent clues as to what the root cause might be. Anyone using Apache HttpComponents coming across this page from googling should take note.

@dlaske
Copy link

dlaske commented Jul 19, 2017

@hollingsworthd
i think i found the reason for this problem.
http://bugs.java.com/view_bug.do?bug_id=7003462
Here is an example how you can reproduce it.

In this Method StreamConnection.getInputStream() you got the same Inputstream twice and open it
with the GZIPInputStream and i think this will be the problem with the closed Inflater.
Now you have to prevent that the same Inputstream will be used twice.

@Gintasz
Copy link
Author

Gintasz commented Jul 20, 2017

@dlaske try fixing it, if it works, do a commit or post the fixed code here. I would very much appreciate it. These timeout settings of mine don't fix it 100% of the time, I still get it, but just little bit bigger success chance.

@hfcipriano
Copy link

I have the same problem, even assigning the timeout values. :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants