jhonathanc / ps3netsrv-android

Android ps3netsrv
Other
25 stars 4 forks source link

[BUG] Random Crash #17

Closed VinnyRadev closed 1 year ago

VinnyRadev commented 1 year ago

Randomly when starting a game the PS corrupt. IMG_20230516_012130

a simple restart fix it until next time.

jhonathanc commented 1 year ago

I'll try one more thing, keep both ParcelFileDescriptor, FileInputStream and FileChannel during the life cycle of object RandomAccessFileLollipop. I think it will solve the I/O bottleneck the application has with SAF (I think this is the cause of random freezes).

aldostools commented 1 year ago

On Lollipop you open/close the file for each read operation. This has a big overhead on performance.

I'm not sure if it's related to this issue, but maybe keeping the objects pfd, fis & fileChannel cached in memory could help.

jhonathanc commented 1 year ago

Understood, but I'm afraid it could lead to the same problem solved on this commit:

https://github.com/jhonathanc/ps3netsrv-android/commit/54c4be7768b449f10015330cf881dbf5a050f7b1

The main difference is I'll keep all necessary pointers in memory to avoid the GC to collect them. I'll create a new branch to let me merge this and check if the performance increased.

jhonathanc commented 1 year ago

@VinnyRadev, could you please test this?

https://github.com/jhonathanc/ps3netsrv-android/suites/12932337059/artifacts/698689215

VinnyRadev commented 1 year ago

on the first try to start a game it did corrupt it.

VinnyRadev commented 1 year ago

on second start same game without refresh of xml and games ,it did load flawlessly

jhonathanc commented 1 year ago

Is there any game that this issue is more noticeable?

aldostools commented 1 year ago

@jhonathanc wouldn't be safer to use a try block when you create the fis object and when you read the file? The new code doesn't handle exceptions with the cached objects ;-)

jhonathanc commented 1 year ago

@jhonathanc wouldn't be safer to use a try block when you create the fis object and when you read the file? The new code doesn't handle exceptions with the cached objects ;-)

On constructor, maybe... But on method "read", the exceptions are handled by the Commands, for example:

https://github.com/jhonathanc/ps3netsrv-android/blob/a9dacee908e26701423100e25cca77f695172420/app/src/main/java/com/jhonju/ps3netsrv/server/commands/ReadFileCommand.java#LL47C1-L56C10

aldostools commented 1 year ago

Ok. I asked, because the previous code used a try block. But if it considered in your logic, then it's fine.

VinnyRadev commented 1 year ago

Is there any game that this issue is more noticeable?

No. But it is always a PS3 game.

VinnyRadev commented 1 year ago

after more tests to reproduce it,it did happen with local hdd game. I'll close it as it may not be the apk at all.