ps2homebrew / Open-PS2-Loader

Game and app loader for Sony PlayStation 2
https://ps2homebrew.github.io/Open-PS2-Loader/
Academic Free License v3.0
2.12k stars 271 forks source link

[ISSUE] Game freezing with Samba after a while [SMB] #79

Open Antoine-H opened 6 years ago

Antoine-H commented 6 years ago

Hello,

I use OPL from https://github.com/Jay-Jay-OPL/OPL-Daily-Builds, latest version to date. I load games over my home network using Samba Version 4.5.12-Debian on a Linux serveur 4.9.0-4-amd64 1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux.

I can play games just fine but when I leave the PS2 to idle for a while (45mn-1h), without touching anything, the game will freeze the next time it tries to load something. I tested this with multiple games.

Has anyone experienced this?

Could there be some settings on the Samba side that I need to adjust?

Here is my smb.conf file. Nothing fancy there.

[global]
        netbios name = Partage
        workgroup = USERS
        ntlm auth = Yes
        security = user
        hosts allow = 192.168.1.

[PS2SMB]
        path = /srv/PS2SMB
        force user = ps2
        hosts allow = 192.168.1.6
        read only = No
        valid users = ps2

Best,

rickgaiser commented 6 years ago

OPL Daily Builds is a very misleading name. It's a fork of OPL, maintained by @Jay-Jay-OPL. You can report the issue there or at ps2-home.com.

Or you can try the latest OPL beta (download link), and see if the issue is there as well?

Antoine-H commented 6 years ago

The guys over at samba told me to edit my config file. I edited according to what they said. I will report here if I get it working.

I will be sure to try the latest OPL beta, as it looks like there isn't much difference in Jay-Jay's version.

RobertSmits commented 6 years ago

@Antoine-H I have the same "problem". My guess is that the server closes the connection after a while and the PS2 doesn't reconnect. Bad answer but an easy workaround is to not leave your game idle for long periods of time.

Antoine-H commented 6 years ago

@RobertSmits I would guess the same. Yep, it looks like if the PS2 keeps loading stuff, it won't freeze :).

RobertSmits commented 6 years ago

From what I have seen with Wireshark (I'm not an expert) it looks like the server closes the connection 'cause of inactivity. And when you need to load extra stuff the PS2 tries to continue to use the old connection instead of opening a new connection.

Jay-Jay-OPL commented 6 years ago

Guys, try this experimental workaround: http://www.ps2-home.com/forum/viewtopic.php?f=83&t=1758 -- it's called the PS2-PINGER -- basically your PC that has the SMB shared folder will continuously be pinging the PS2 unit -- in order to avoid freeze ups and etc.

Might be the solution to your issue. Though it's original intent was for a member that perhaps has a malfunctioning home network, or perhaps his home network is too busy doing other things while trying to play PS2 games.

But yes, try not to keep the game in idle for too long. C'mon 45 min to an hour? What the hell do you expect? It be an issue if it were only 2 or 10 mins, but that is not happening here.

RandQalan commented 6 years ago

Or you could just fix the problem like this sticky says on this post http://psx-scene.com/forums/f150/games-freezing-randomly-when-playing-over-network-104125/#post980499

Antoine-H commented 6 years ago

I am not using Windows. I am actually using Samba on a Linux machine. I will look into setting a lower keepalive value, which should do what you guys described. See https://www.samba.org/samba/docs/using_samba/ch11.html

RandQalan commented 6 years ago

set dead time -1 might have effect of turning of auto disconnection

sp193 commented 6 years ago

As of now, there is no code for reconnecting when the connection is lost. The code for establishing the connection is discarded once the connection is made, to save IOP RAM.

TnA-Plastic commented 6 years ago

It's crazy, that i.e. 348 Byte(!!!) can make 10 games not load via SMB! Well, let's hope that we could have a 're-connention'-support (in-game) AND a bit smaller lib (lwip seems to have a few things, which probably can be removed... The other stuff seems to be quite adapted to the PS2!), so we can enjoy all our games via SMB as well!

ChristinMilloy commented 6 years ago

This has become an issue in our house as well, where our timeouts appear to be much shorter (games freeze after a couple of minutes if they even load to actual gameplay at all).

We are trying to serve backups using a linux-based Drobo NAS where manual configuration of samba is nontrivial. There is also a gigabit switch and the router interposed but this doesn't cause issues on any other devices. Switching to a windows-hosted share folder isn't a viable solution in our use case.

Some solution to the keepalive problem that lives within OPL on the PS2, without requiring special configuration on the server side, would be ideal if it is possible.

rickgaiser commented 6 years ago

games freeze after a couple of minutes if they even load to actual gameplay at all

What version are you using? I've had similar issues since 19 May, but they where related to slow network speeds, not timeouts. This issue should be fixed in the latest version (1082).

TnA-Plastic commented 6 years ago

Please take a look at this thread and try the 'dirty-builds'!

--> http://www.ps2-home.com/forum/viewtopic.php?t=1758&view=unread#unread

If it indeed works, I hope you can post a reply here (and possibly on that site as well)!

ChristinMilloy commented 6 years ago

All pages at ps2-home.com have been coming up dead for me all day long. It has made troubleshooting a pain so far, haha. I'll see what I can pull up from google cache...

TnA-Plastic commented 6 years ago

Yes, it seems to be down currently. If google-cache doesn't help, maybe that thread recently got backed up on the web-archive.

Or just wait a bit, until it is up again.

Those dirty-builds have an increased ARP-Table-size, so some games might not start anymore (due to limited IOP-RAM). However, the size-increase is less than a KB, so there are probably not many games out of the giant PS2-Game-Library of games, who possibly become incompatible.

ChristinMilloy commented 6 years ago

No joy on the wayback machine. Apparently ps2-home.com deliberately disabled crawlers (facepalm.jpg).

I'll come and report back my findings once I eventually get on the forums and figure out which build(s) to try. Thanks for the directions so far.

TnA-Plastic commented 6 years ago

Yes, I've just seen it...

Well...Maybe @Jay-Jay-OPL comes around and can link it here, or the forum hopefully will soon be running again.

The issue however seems to be EXACTLY, what was mentioned/discussed at the end of the thread. I suppose you have more than 2 devices connected?!

ChristinMilloy commented 6 years ago

Okay I just read the first 70 posts in that thread... Wow. I REALLY wish that forum's server hadn't been dead 18 hours ago when I was first struggling with this. Discussion there is very enlightening, I'm still reading through.

Already I can say I think you're right, ARP table overflow smells like it's the problem here. I can tell you I'm currently using OPL v0.9.3 and I don't know off-hand what APR value was compiled in that version, but yes, at any given moment I'm running between 8 and 30 connected devices in my network at once, so.

This would also explain why it worked flawlessly, longest yet, for an uninterrupted 10 minutes one time only -- right after a hard router reboot, I had the PS2 and NAS configured static, and started the game immediately before other devices had a chance to re-identify and start screaming at each other. And of course, once they did that's when it failed again.

I will test a couple of the 'dirty' builds posted in that forum later today when my girlfriend is done playing PS4 so I can get the TV, and report back.

ChristinMilloy commented 6 years ago

Okay - @rickgaiser @TnA-Plastic Not going to lie, I kind of feel like I've just emerged from a hurricane of confusing nonsense, but I think I'm 100% up to speed now. Part of the problem is (having no access to ps2-home when it was down yesterday) I was never clear until tonight which of you @Jay-Jay-OPL @ifcaro devs was whom, and who had forked off whose repo, when, or for what reasons (I'm still a little unclear on the last point). It's especially difficult to follow given that Jay Jay seems to have split the discussion topic apart into a half a dozen separate threads for some reason (!?), and that at some point this was a bitbucket repo and not a git repo... Yikes.

So in any event, I deeply apologize if this is the wrong place to even be discussing this, it's not my intent to offend, insult or annoy anyone... Nevertheless, here are my diagnostic results FWIW:

I thought best to do 50/50 on the "dirty" builds from @Jay-Jay-OPL so I ran 1st and 6th (last). For clarity, these are the versions I tested:

"dirty (v1)" OPL_1062_DB-TA-DIRTY_all-03304e0-2018-06-23 "dirty (v6)" OPL_1064_DB-TA-DIRTY_v6_all-7be92c8-2018-07-02

BOTH versions completely and utterly fixed the problem. Totally resolved. We had uninterrupted gameplay on a variety of titles for more than an hour on each version, and in all that time we only saw one minor, tiny instance of very slight stutter on one pre-rendered FMV in one title.

I'm 99% certain the meat of the issue I had before with the official release was the ARP-table flooding problem which is solved in Jay-Jay's "dirty" betas... However just from looking at the betas running in the tests, it's clear there are a lot of other unrelated changes in the codebase between the fork and the parent. If I were to stick with this codebase here, I'd have to apply my own ARP patch equivalent to the one established in the other thread.

So my question has to be, what's the appropriate way for me to proceed? Is this repo still being maintained? Is Jay Jay just doing new beta feature dev, or is his fork more-or-less the only current main dev channel for OPL? Is there some philosophical difference or disagreement keeping pull requests from happening or the ARP patch from being done to the main release?

Please forgive me my ignorance and have mercy in your replies, thanks.

ChristinMilloy commented 6 years ago

P.S. Just to maintain my sanity I'm about to test the latest official 0.9.3 beta to see whether this issue is resolved.

ChristinMilloy commented 6 years ago

Yeah on my network it's still fucked on OPL r1082 from the 0.9.3 Betas package.

ChristinMilloy commented 6 years ago

Okay I found the relevant PR and relevant recent comments and I'm waiting with bated breath. Maybe I should have some tea. #101 Sorry I almost lost my mind, I've been up wrestling with this issue since last night.

TnA-Plastic commented 6 years ago

The @ifcaro -repo is the original project and you can see which one is the fork, by looking under the 'fork-string', where it mentions, where it is forked from.

Ifcaro does not have this... Ergo --> The official project.

You can also take a look at the Readme of both forks!

Yes, it (ifcaro-repo) was a bitbucket-repo a while ago!

Yes, he (@Jay-Jay-OPL) probably splitted it to keep the topics a bit more structured. He however ever references to the new threads, so they are still connected to each other and those who are interested in it, should still find all informations easily. ;)

The reasons for the Jay-Jay-OPL-fork are, that he wanted to implement some things (other visuals a tighter integration of POPStarter and some other things) and some of his ideas just do not match either some developers wishes (especially in POPStarter's and OPL's case) or the 'idea of implementation' it should have (i.e. the second Apps-Page is programmed in a VERY REDUNDANT way... It is doubled code, which is one of the main-things you should avoid in a program!!! Avoiding redundancy belongs to the 10...naaahh...4 basic rules of development/programming!)

The place is alright, but it might/would be appreciated if you don't post 4 replies, but rather less (at least within ~24hours). You can edit your comments as well! ;)

Allllllllright! So that fixed your problem! That's great to know, indeed! THX for your confirmation! I think we have ~4-5 Testers now, so I think this issue (not only THAT, but WHY the ARP-Table still overflows, or why it 'kicks out' the ARP-Entry of the connection we need to have [to the SMB-Server/PC/NAS/etc.] in the first place) can be tracked down quite fast.

Btw.: Might it be possible to just 'keep' the ARP-Entry to the desired SMB-Host/Server and ignore any further incoming ARPs for other devices, once 'in-game'...? Then we would not even need to increase the ARP-Table-size.

BOTH repositories are still under continuous maintenance! Look at the number of forks and sub-branches (I am referring to all branches of all forks of OPL here) the ifcaro-repo has! ;) You can BET on it, that there will be new releases for a while as well!

The Jay-Jay-OPL-fork is also continuously maintained! All ifcaro-fork-patches/updates get included! It is developed in conjunction with 'OPL Manager' (by @danielb ), which supports both repos and the/some additional features of OPL-DB (OPL 'Daily Builds' is the Jay-Jay-OPL-fork).

Well, the guys on the ifcaro-fork/branch/... rather want to be consistent in properly coding the features... The OPL-DB focuses more on features, even if the code might not be as good or still 'WIP'. Increasing the ARP-Table just seems like a workaround, to just not trigger the bug. However... It would still be present and the guys here on the ifcaro-repo want a proper implementation, which includes fixing a bug rather than working around it!

If there is no better way to fix it, then this probably will be adapted!

ChristinMilloy commented 6 years ago

Thanks, that's very helpful and you've given me everything I need to learn more. I appreciate it! @TnA-Plastic

sp193 commented 6 years ago

Now that a related patch has been suggested, tested and merged, I recommend that this issue ticket be closed if there are no further comments.

Antoine-H commented 6 years ago

I have just tried with OPL available from https://akuhak.github.io/test_build/ (build time: 2018-07-18_12:09:23 commit: 45c9a78) and I still experience the same problem.

I am using Samba version 4.5.12-Debian and my /etc/samba/smb.conf file hasn't changed since my first post.

To test it out, I launched a game, then died, then waited on the screen that offers to try again for like an hour. When I hit the try again button, I was able to play once then it froze.

@sp193 Thank you very much for the patch you provided. Could you explain how you tested it? I'll see if I can reproduce the steps :). Maybe something else is wrong with my setup. I can provide you with some Samba logs if you want.

sp193 commented 6 years ago

I only just tried to see if it booted any games. I came, I heard and I found problems that were not addressed. But they might not have been the only problems with the system.

I heard that the Samba users were also having issues with the Samba server closing the connection after a period of inactivity. That will kill the connection permanently because the in-game driver cannot ever reconnect. For this issue, it is an exercise for the OPL developer(s) to solve. :')

Antoine-H commented 6 years ago

I have just tried setting deadtime = 0 in Samba so that it wouldn't close the connection (if I understood correctly), then waited for some time and it freezes again.

@sp193 All right. Thanks again :).

TnA-Plastic commented 6 years ago

I suppose this still happens?! :-|

Antoine-H commented 6 years ago

@TnA-Plastic Just tried again and yes it does.

TnA-Plastic commented 4 years ago

...and a year later? :-/

Antoine-H commented 4 years ago

It still happens. The game freezes if I leave it for an hour then come back. Here is the samba log.

[2019/10/13 18:53:14.939847,  3] ../source3/smbd/process.c:1956(process_smb)
  Transaction 10218 of length 63 (0 toread)
[2019/10/13 18:53:14.939888,  3] ../source3/smbd/process.c:1543(switch_message)
  switch message SMBreadX (pid 13787) conn 0x55b3fd4beb60
[2019/10/13 18:53:14.939925,  3] ../source3/lib/util.c:1069(fcntl_getlock)
  fcntl_getlock: fd 33 is returned info 2 pid 0
[2019/10/13 18:53:14.940015,  3] ../source3/smbd/aio.c:276(aio_pread_smb1_done)
  handle_aio_read_complete file DVD/SLES_516.97.SSX 3.iso max=8192 nread=8192
[2019/10/13 18:53:14.945982,  3] ../source3/smbd/process.c:1956(process_smb)
  Transaction 10219 of length 63 (0 toread)
[2019/10/13 18:53:14.946027,  3] ../source3/smbd/process.c:1543(switch_message)
  switch message SMBreadX (pid 13787) conn 0x55b3fd4beb60
[2019/10/13 18:53:14.946109,  3] ../source3/lib/util.c:1069(fcntl_getlock)
  fcntl_getlock: fd 33 is returned info 2 pid 0
[2019/10/13 18:53:14.946208,  3] ../source3/smbd/aio.c:276(aio_pread_smb1_done)
  handle_aio_read_complete file DVD/SLES_516.97.SSX 3.iso max=8192 nread=8192
[2019/10/13 18:53:14.950101,  3] ../source3/smbd/process.c:1956(process_smb)
  Transaction 10220 of length 63 (0 toread)
[2019/10/13 18:53:14.950177,  3] ../source3/smbd/process.c:1543(switch_message)
  switch message SMBreadX (pid 13787) conn 0x55b3fd4beb60
[2019/10/13 18:53:14.950244,  3] ../source3/lib/util.c:1069(fcntl_getlock)
  fcntl_getlock: fd 33 is returned info 2 pid 0
[2019/10/13 18:53:14.950447,  3] ../source3/smbd/aio.c:276(aio_pread_smb1_done)
  handle_aio_read_complete file DVD/SLES_516.97.SSX 3.iso max=6144 nread=6144
[2019/10/13 18:53:14.955994,  3] ../source3/smbd/process.c:1956(process_smb)
  Transaction 10221 of length 63 (0 toread)
[2019/10/13 18:53:14.956069,  3] ../source3/smbd/process.c:1543(switch_message)
  switch message SMBreadX (pid 13787) conn 0x55b3fd4beb60
[2019/10/13 18:53:14.956135,  3] ../source3/lib/util.c:1069(fcntl_getlock)
  fcntl_getlock: fd 33 is returned info 2 pid 0
[2019/10/13 18:53:14.956281,  3] ../source3/smbd/aio.c:276(aio_pread_smb1_done)
  handle_aio_read_complete file DVD/SLES_516.97.SSX 3.iso max=2048 nread=2048
[2019/10/13 19:52:35.354150,  1] ../source3/smbd/process.c:550(receive_smb_talloc)
  receive_smb_raw_talloc failed for client ipv4:192.168.1.6:11834 read error = NT_STATUS_HOST_UNREACHABLE.
[2019/10/13 19:52:35.354406,  2] ../source3/smbd/close.c:802(close_normal_file)
  ps2 closed file VMC/SLES_516.97_0.bin (numopen=1) NT_STATUS_OK
[2019/10/13 19:52:35.354501,  2] ../source3/smbd/close.c:802(close_normal_file)
  ps2 closed file DVD/SLES_516.97.SSX 3.iso (numopen=0) NT_STATUS_OK
[2019/10/13 19:52:35.354548,  2] ../source3/smbd/service.c:1129(close_cnum)
  192.168.1.6 (ipv4:192.168.1.6:11834) closed connection to service PS2SMB
[2019/10/13 19:52:35.354970,  3] ../source3/smbd/server_exit.c:237(exit_server_common)
  Server exit (failed to receive smb request)
BatRastard commented 4 years ago

Is there a difference between a Samba log and a Wireshark capture?

I'm used to the latter and whenever I performed a Wireshark capture while having an SMB share, it seemed to tell me exactly what wrong when a game crashed or froze up ...

Edit: Holy moly, just read the entire thread! I was going to recommend the old saw - i.e. if your PS2 ISOs are on a USB hard drive connected to the host machine with the Samba server, and the OS is set to automatically turn off USB ports after being idle for some time, then that is most likely the cause for the freezes since the USB drive turned off, and thus the Samba connection closed and can't reopen.

But overflowing ARP-tables?!? Whole new ballgame there!

Kudos to that discovery and everyone trying their best to fix it! :)

TnA-Plastic commented 4 years ago

Still sounds like a timeout, IMO. Isn't that a kind of session-timeout on the server-side?

Well... I suppose OPL could be changed to ask for a new session after some time (or when it retrieves the answer that something went wrong), but since that would probably vary depending on the host/SMB-Server, I think the main-problem is on the server-side.

Except if the issue is within OPL and it is closing the session or timing out on OPL's side...

Have you ever tried an old OPL-Version? Does it happen on something like OPL 0.6?

Edit: Oooooh, I just re-read some of the stuff already posted. Oh dear...

felipemarins commented 4 years ago

This also happens to me on OPL 0.9.3+.1537-Beta-7a9314 with a SMB server on Windows 10. After playing for some time, the game simply freezes. The longest time that I could play was 1 hour and 40 minutes. The problem, in my case, may be with the default Windows Broadcom Netlink Ethernet adapter driver (that disconnect from internet after high transfer rates, so I have to enable "Receive side scaling" to avoid this), but I don't know how to test in Linux because the Samba has dropped the support for SMBv1.

zappepappe commented 4 years ago

I believe that appending: server min protocol = NT1 to [global] in smb.conf will give you back SMBv1 support in Samba.

felipemarins commented 4 years ago

I guess I have tried this and got an error 301 on OPL, but I will try again.

felipemarins commented 4 years ago

It worked, but now there are no games on OPL. I just had to change my home folder permissions.

felipemarins commented 4 years ago

So the problem was not the driver. I just played two games, one froze after 11 minutes, and the other one froze after 5 minutes (I timed).

zappepappe commented 4 years ago

Do you have a busy network? Try making a more direct connection between the server and the PS2 and remove all other devices on the network.

felipemarins commented 4 years ago

I have 2 devices connected to WiFi and I connect the PS2 and the PC direct on modem. I will try disconnect the other devices from WiFi.

felipemarins commented 4 years ago

So I tested first with the devices disconnected from WiFi and I played for more than 1 hour without freezes. After this, I tested with the ethernet cable connected directly to the computer and I played for nearly 2 hours without freezes. Looks like the problem was my modem. (The only issue that I noticed is that VMC writing on ext4 seems to be very slow, but it's unrelated to this issue (maybe I should open another))

pc-2198x commented 3 years ago

I can confirm this happens with my Synology NAS. I configured the smb.conf on my NAS to never timeout until it hits the 4 hour mark, yet I can re-produce the freeze consistently while letting the console stay idle for ~15 min on particular titles. Both the PS2 and NAS are connected via Ethernet on the same router. Tried multiple routers, same results.

t-dome commented 2 years ago

I can confirm this happens with my Synology NAS. I configured the smb.conf on my NAS to never timeout until it hits the 4 hour mark, yet I can re-produce the freeze consistently while letting the console stay idle for ~15 min on particular titles. Both the PS2 and NAS are connected via Ethernet on the same router. Tried multiple routers, same results.

In what titles? I also have this issue with my Synology. 2 years ago I could consistently reproduce this in Gun when speaking to a particular trader (without leaving the console idle at all), but now it doesn't exhibit this anymore. Just randomly (rarely) it crashes when exiting the game. Maybe some updates from Synology partially solved this in the meantime. I also did get random freezes in Half-Life and Max Payne 2 about every 30 minutes; I still have to retest these games now.

As an alternative I just connected a USB stick to my new Asus router and activated SMB on it, and so far this seems to be stable. If this works on the long term I can ditch my fat PS2 with the internal HDD setup (which works 100% perfectly, but is quite cumbersome to maintain) and go for a slim one.

t-dome commented 2 years ago

The issue still persists. I tried version 0.8, where it says in the changelog that a keep-alive has been implemented, as well as the latest stable 1.1.0. Happens with my Synology NAS and as well SMB configured over an USB stick directly in my Asus router.

After max. 50 minutes of idle time in a game, it just crashes when continuing. For example in Gun, which streams data when running around the map.

In this state, SMB is practically unusable on the PS2.

ghost commented 2 years ago

I don't know what exactly happens but, some month ago last year it's totally playable playing gran turismo 4 in SMB. but now it crashed randomly, seems like the data not transfered to the console somehow.

i was cleaned install my windows 10 due to messy dualboot, updated to 2H something, re-setup SMB, updated opl to the latest and bang this crash occur. it's comes randomly for me like 1-3 minutes idle and it crash.

privacy313 commented 2 years ago

Monitoring this as I still have the issue after about 10 minutes of inactivity. I have tried adding deadtime = 0 and keepalive = 30 to smb.conf but the issue persists.

Docmine17 commented 2 years ago

I have this problem in Gran Turismo 4...

James-F2 commented 1 year ago

Is this issue being worked on? Still happens on v1.2.0-Beta-1949-238ed8e (Dec 4th, 2022). SMB is what keeps this awesome console alive, how is this not a top priority to be fixed?