beatsaber-http-status icon indicating copy to clipboard operation
beatsaber-http-status copied to clipboard

status.json can only be requested once

Open Chickenbreadlp opened this issue 3 years ago • 11 comments

Current behavior

When trying to request the status.json, HTTP-Status will only return the json once. Every subsequent request will either reset the connection or return an empty response. (different browsers show different errors) HTTP-Status will only return the status.json again, once BeatSaber was closed and has been reopened.

Expected behavior

status.json should be returned no matter how often it is requested in one session.

Reproduction steps

  1. Send a GET request on localhost:6557/status.json
  2. Send another GET request on localhost:6557/status.json

Environment

BeatSaber version: 1.14.0 HTTP Status version: 1.15.0 Platform: Index, Windows 10 20H2

Chickenbreadlp avatar Mar 20 '21 16:03 Chickenbreadlp

Quick update: I've been unable to run BSIPA since the last update and I haven't been able to figure out why, so I can't test this in practice.

That aside, I'm not sure why it doesn't work for you. As far as I can tell the mod handles serving HTTP requests as the library would expect it, and from what I recall this worked just fine for me in the past. I'll retest when I can get the game working. I guess the only thing I can recommend is that you use the websocket connection instead for now.

opl- avatar Mar 22 '21 02:03 opl-

I was honestly unsure, why it happened either and first put it down to be an issue of my own Stream overlay, but I got the issue no matter how I tried to load the JSON file... I guess it might be a mod conflict in my case, considering that some Maps using Noodle Extensions don't fire the songStart event either. That's actually how I found this in the first place, trying to circumvent this issue with Noodle Extension maps xD

I'll investigate this in my own environment as well, and see if I can find anything...

Chickenbreadlp avatar Mar 22 '21 16:03 Chickenbreadlp

I found a thread-safety issue that I believe could cause this issue sometimes and fixed it in #60. There was no synchronization between the reads of StatusManager in handling the /status.json request from the HttpServer thread and the writes to StatusManager from the game thread, so the reads could get old values.

Macil avatar Apr 10 '21 16:04 Macil

Is this still an issue with v1.15.1?

opl- avatar Apr 18 '21 12:04 opl-

I've just tried with the 1.15.1 of HTTP-Status and it is still an issue...

Chickenbreadlp avatar Apr 18 '21 18:04 Chickenbreadlp

Just tested this on Beat Saber 1.17.0 with the upcoming version of HTTP Status and I can't reproduce this on my system. If you can still reproduce this, you'll have to provide the game logs from a session where this happened.

opl- avatar Sep 07 '21 23:09 opl-

I am having this issue, but I'm on 1.11.3 (game version 1.11.1).

The first request works fine, subsequent requests don't work anymore until I restart the game. In Firefox, I get:

The connection was reset
The connection to the server was reset while the page was loading.

Via PowerShell:

> Invoke-WebRequest http://localhost:6557/status.json
Invoke-WebRequest : The underlying connection was closed: The connection was closed unexpectedly.
At line:1 char:1
+ Invoke-WebRequest http://localhost:6557/status.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

The log shows nothing of note:

[INFO @ 12:41:38 | Beat Saber HTTP Status] Starting HTTP server on port 6557
[INFO @ 12:41:57 | Beat Saber HTTP Status] Standard Level loaded
[INFO @ 12:43:01 | Beat Saber HTTP Status] Stopping HTTP server

Any help would be appreciated!

CaiB avatar Sep 18 '21 18:09 CaiB

@CaiB, is there any reason you're using a version of the game this old? I'm not even able to downgrade to it through Steam's download_depot, as it fails with Depot download failed : Manifest not available.

opl- avatar Sep 24 '21 16:09 opl-

@opl- Yes, we have a few reasons, such as being able to use the pre-official multiplayer via a mod. I’m not really interested in upgrading game versions, but I do understand if you’re not willing to spend time supporting outdated versions of the game.

Steam disabled that about a year ago. The client refuses to download any old depots for no good reason (and people think Windows update is bad…) You can use a 3rd party depot downloader to get it, or even use a memory editor to patch out that client-side check in the Steam DLL to be able to download the depot.

Any help you are willing to provide would be much appreciated!

CaiB avatar Sep 24 '21 19:09 CaiB

Sure love locking away a tool which is already hidden away from people! Apparently I still have a backup of some 1.11.x version on my disk, so I could try using that at some point.

The only change I can think of that might be related is #60, which should fix concurrent access issues. You could try backporting it. Other than that I have no idea what could be going wrong, especially without any exceptions. I don't really use the /status.json endpoint myself for anything, so I've never experienced this issue myself.

opl- avatar Sep 24 '21 21:09 opl-

@opl- Alright, we'll see if we can do that. Thanks!

CaiB avatar Sep 24 '21 23:09 CaiB