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

FileNotFoundException drops the request #394

Closed
CodeBreak524 opened this issue Jul 21, 2020 · 6 comments · Fixed by #396
Closed

FileNotFoundException drops the request #394

CodeBreak524 opened this issue Jul 21, 2020 · 6 comments · Fixed by #396
Labels
bug Something isn't working

Comments

@CodeBreak524
Copy link

After performing one of the requests in my app I receive that kind of error which results in failed request:

java.io.FileNotFoundException: /data/user/0/app.name.dev/cache/chucker-21 (No such file or directory)
        at java.io.FileOutputStream.open0(Native Method)
        at java.io.FileOutputStream.open(FileOutputStream.java:308)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
        at okio.Okio__JvmOkioKt.sink(JvmOkio.kt:170)
        at okio.Okio.sink(Unknown Source:1)
        at okio.Okio__JvmOkioKt.sink$default(JvmOkio.kt:170)
        at okio.Okio.sink$default(Unknown Source:1)
        at okio.Okio.sink(Unknown Source:3)
        at com.chuckerteam.chucker.internal.support.TeeSource.<init>(TeeSource.kt:27)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.multiCastResponseBody(ChuckerInterceptor.kt:184)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:93)

Repeating the same request doesn't solve this problem, but performing a different request does.

💣 Steps to reproduce

It happens after giving the control off app to another third-party library. I cannot tell you more concrete info because I really don't know what happens inside this library. Maybe it clears all caches of app which then results in Chucker error.

🔧 Expected behavior

Anyway it seems that dropping the request with internal error is not the best option. A warning should be enough even though the request wouldn't be logged.

Tech info - different devices, different OS versions

@MiSikora
Copy link
Contributor

MiSikora commented Jul 21, 2020

I considered whether this should be wrapped in a try/catch block but decided against it while implementing response handling.

private val sideStream = Okio.buffer(Okio.sink(sideChannel))

In my opinion, the issue should be reported to this third-party vendor as a bug. However, I also understand where are you coming from. We could ignore the processing body of requests which fail to create a file.

@vbuberen @cortinico what do you think? Do you see a need for some special message for requests that fail for this reason? Personally I don't think so as from my perspective it is the same as any IO failure during writes or reads from a file. On the other hand, it might be harder in the future to analyze similar issues. Maybe there should be some UI to indicate this type of errors?

@cortinico cortinico added the bug Something isn't working label Jul 25, 2020
@cortinico
Copy link
Member

In my opinion, the issue should be reported to this third-party vendor as a bug. However, I also understand where are you coming from. We could ignore the processing body of requests which fail to create a file.

Ideally that should be the right thing to do.

On the other hand, it might be harder in the future to analyze similar issues. Maybe there should be some UI to indicate this type of errors?

How about printing the stacktrace with some extra message? That will help at least debugging once we get users reporting those kind of issues.

@ghost ghost added the Pending PR The resolution for the issue is in PR label Jul 26, 2020
@ghost ghost removed Pending PR The resolution for the issue is in PR bug Something isn't working labels Jul 28, 2020
@cortinico cortinico added the bug Something isn't working label Jul 28, 2020
@CodeBreak524
Copy link
Author

Guys, I tried 3.3.0-SNAPSHOT version and haven't received FileNotFoundException again. But now I'm receiving another exception in the same place:

 java.io.IOException: No such file or directory
        at java.io.UnixFileSystem.createFileExclusively0(Native Method)
        at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:281)
        at java.io.File.createNewFile(File.java:1008)
        at com.chuckerteam.chucker.internal.support.AndroidCacheFileFactory.create(AndroidCacheFileFactory.kt:21)
        at com.chuckerteam.chucker.internal.support.AndroidCacheFileFactory.create(AndroidCacheFileFactory.kt:15)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.multiCastResponseBody(ChuckerInterceptor.kt:184)
        at com.chuckerteam.chucker.api.ChuckerInterceptor.intercept(ChuckerInterceptor.kt:92)

It happens even after removing the application from device and reinstalling a new one.

@MiSikora
Copy link
Contributor

MiSikora commented Aug 12, 2020

Well… that's not cool. Does it happen for all requests or only for some of them as well?

@cortinico @vbuberen FYI - don't know if you'd like to reopen this issue or create a new one (technically it is a different thing).

@vbuberen
Copy link
Collaborator

Yes, we should open a new issue. I will handle it.

@vbuberen
Copy link
Collaborator

@CodeBreak524 I invite you to the new issue to provide more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants