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

postCachedMethods does not handle null return value from File.listFiles() #62

Closed
DanFTRX opened this issue Jun 24, 2019 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@DanFTRX
Copy link

DanFTRX commented Jun 24, 2019

https://github.com/MindscapeHQ/raygun4android/blob/master/provider/src/main/java/com/raygun/raygun4android/CrashReporting.java#L165

https://docs.oracle.com/javase/7/docs/api/java/io/File.html#listFiles()

listFiles() can return null in some cases and raygun errors on it rather than handling gracefully.

@TheRealAgentK TheRealAgentK self-assigned this Jun 24, 2019
@TheRealAgentK
Copy link
Contributor

Hey @DanFTRX - Thanks for that report, I'll have a look at a fix later today.

Out of curiousity - may I ask in which scenario(s) that occurred for you? And were you using the v4 final or are you on the older 3.0.6 release?

@DanFTRX
Copy link
Author

DanFTRX commented Jun 24, 2019

@TheRealAgentK I was on the older 3.0.6 release, however the code in question did not change between the two versions(aside from moving from RaygunClient to CrashReporting) As for the scenario, it occured when sending up an exception. Unfortuanently I do not have reproduction steps.

@TheRealAgentK
Copy link
Contributor

@DanFTRX Yeah, I saw this is code from 3.0.x and would show the same behaviour.

Bugger you don't have a repro. Will have a bit of a deeper look in which scenarios building that path could fail. Did you see it on any particular devices or Android versions?

@DanFTRX
Copy link
Author

DanFTRX commented Jun 24, 2019

This is the environment section of the raygun report:

       "architecture": "arm64-v8a",
       "availablePhysicalMemory": 1797,
       "availableVirtualMemory": 0,
       "board": "sdm630",
       "brand": "Sonim",
       "currentOrientation": "Portrait",
       "deviceCode": "XP8800",
       "deviceName": "XP8800",
       "diskSpaceFree": 0,
       "locale": "en_US",
       "oSVersion": "8.1.0",
       "osSDKVersion": "27",
       "processorCount": 1,
       "totalPhysicalMemory": 0,
       "totalVirtualMemory": 0,
       "utcOffset": -4,
       "windowsBoundHeight": 1920,
       "windowsBoundWidth": 1080

This is the relevant part of the StackTrace:

main.java.com.mindscapehq.android.raygun4android.RaygunClient.postCachedMessages in RaygunClient.java::611
main.java.com.mindscapehq.android.raygun4android.RaygunClient.send in RaygunClient.java::384

Oh and as a bonus, now that I am looking at my report again, I notice that the OS had too many open files at the time. So I would guess that the reproduction steps is to induce that state again. I send my logcat up with Raygun reports and it got this:

  java.io.IOException: Cannot run program \"logcat\": error=24, Too many open files

And as File.listFiles() is documented as returning null on IOExceptions, this tracks as being the cause.

TheRealAgentK added a commit to TheRealAgentK/raygun4android that referenced this issue Jun 29, 2019
…efore looping over files, this is a fix for MindscapeHQ#62 (where the OP reported they saw it with the device open files being exhausted).
@TheRealAgentK TheRealAgentK added this to the 4.0.1 milestone Jun 29, 2019
@TheRealAgentK
Copy link
Contributor

Thx @DanFTRX, this is fixed in my dev build and will go out to a 4.0.1 release in the next few days.

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

2 participants