1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 04:19:53 +08:00
Bartłomiej Dach caffc7238b Do not forcibly log out user if user retrieval fails with a server error code (#36897)
* Do not forcibly log out user if user retrieval fails with a server error code

This behaviour caused users to get forcibly logged out of the game
during yesterday's redis outage.

From one case where logs were provided
(https://discord.com/channels/188630481301012481/1097318920991559880/1480201862610423933):

- User had repeated timeouts on API requests; consequently, API went
  into failing state
- On one of the login retries `/api/v2/me` returned a 500 with no error
  details (`{"error":"null}` JSON response) which resulted in
  an instant logout as per

  https://github.com/ppy/osu/blob/7263551aa868911a7d9148cf2cb16f9e0325f531/osu.Game/Online/API/APIAccess.cs#L323-L324

This PR intends to only forcibly log the user out if the returned error
code indicates a client error. If it is a server error, the login is
preserved and a normal retry loop proceeds.

This can be tested with a local web instance via following steps:

1. Start `osu-web` and a client instance connected to it.
2. Log in on the client instance.
3. Kill (`^C`) `osu-web`.
4. Trigger a few requests in the client and wait for enough of them to
   fail for the API to change to `Failing` state.
5. Apply

```diff
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index db34639abf2..392a844882a 100644
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -581,6 +581,8 @@ class UsersController extends Controller
      */
     public function me($mode = null)
     {
+        abort(500);
+
         $user = \Auth::user();
         $currentMode = $mode ?? $user->playmode;

```

6. Start `osu-web` again.
7. On master this will log the user out forcibly. On this PR, the user
   will remain in `Failing` state.
8. Undo patch from step (5) (restarting web is not required).
9. On this PR, the client will be logged back in.

* Update framework

---------

Co-authored-by: Dean Herbert <pe@ppy.sh>
caffc7238b · 2026-03-10 15:12:43 +09:00
76,642 Commits
2025-02-14 06:25:53 -05:00
2024-02-16 01:45:38 +03:00
2024-05-10 18:38:11 +08:00
2026-03-07 23:19:13 +09:00
2025-07-09 12:46:14 +09:00
2024-07-05 13:00:10 +09:00
2024-02-05 18:02:07 +09:00
2022-04-14 12:37:42 +09:00
2022-04-14 12:37:42 +09:00
2025-07-09 12:46:14 +09:00
2019-10-30 21:54:14 +08:00
2025-01-12 19:16:53 +09:00

osu! logo

osu!

Build status GitHub release CodeFactor dev chat Crowdin

A free-to-win rhythm game. Rhythm is just a click away!

This is the future and final iteration of the osu! game client which marks the beginning of an open era! Currently known by and released under the release codename "lazer". As in sharper than cutting-edge.

Status

This project is under constant development, but we do our best to keep things in a stable state. Players are encouraged to install from a release alongside their stable osu! client. This project will continue to evolve until we eventually reach the point where most users prefer it over the previous "osu!stable" release.

A few resources are available as starting points to getting involved and understanding the project:

Running osu!

If you are just looking to give the game a whirl, you can grab the latest release for your platform:

Latest release:

Windows 10+ (x64) macOS 12+ (Intel, Apple Silicon) Linux (x64) iOS 13.4+ Android 5+

You can also generally download a version for your current device from the osu! site.

If your platform is unsupported or not listed above, there is still a chance you can run the release or manually build it by following the instructions below.

For iOS/iPadOS users: The iOS testflight link fills up very fast (Apple has a hard limit of 10,000 users). We reset it occasionally. Please do not ask about this. Check back regularly for link resets or follow peppy on twitter for announcements. Our goal is to get the game on mobile app stores very soon so we don't have to live with this limitation.

Developing a custom ruleset

osu! is designed to allow user-created gameplay variations, called "rulesets". Building one of these allows a developer to harness the power of the osu! beatmap library, game engine, and general UX for a new style of gameplay. To get started working on a ruleset, we have some templates available here.

You can see some examples of custom rulesets by visiting the custom ruleset directory.

Developing osu!

Prerequisites

Please make sure you have the following prerequisites:

When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of Visual Studio, JetBrains Rider, or Visual Studio Code with the EditorConfig and C# Dev Kit plugin installed.

Downloading the source code

Clone the repository:

git clone https://github.com/ppy/osu
cd osu

To update the source code to the latest commit, run the following command inside the osu directory:

git pull

Building

From an IDE

You should load the solution via one of the platform-specific .slnf files, rather than the main .sln. This will reduce dependencies and hide platforms that you don't care about. Valid .slnf files are:

  • osu.Desktop.slnf (most common)
  • osu.Android.slnf
  • osu.iOS.slnf

Run configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the osu! (Tests) project/configuration. More information on this is provided below.

To build for mobile platforms, you will likely need to run sudo dotnet workload restore if you haven't done so previously. This will install Android/iOS tooling required to complete the build.

From CLI

You can also build and run osu! from the command-line with a single command:

dotnet run --project osu.Desktop

When running locally to do any kind of performance testing, make sure to add -c Release to the build command, as the overhead of running with the default Debug configuration can be large (especially when testing with local framework modifications as below).

If the build fails, try to restore NuGet packages with dotnet restore.

Testing with resource/framework modifications

Sometimes it may be necessary to cross-test changes in osu-resources or osu-framework. This can be quickly achieved using included commands:

Windows:

UseLocalFramework.ps1
UseLocalResources.ps1

macOS / Linux:

UseLocalFramework.sh
UseLocalResources.sh

Note that these commands assume you have the relevant project(s) checked out in adjacent directories:

|- osu            // this repository
|- osu-framework
|- osu-resources

Code analysis

Before committing your code, please run a code formatter. This can be achieved by running dotnet format in the command line, or using the Format code command in your IDE.

We have adopted some cross-platform, compiler integrated analyzers. They can provide warnings when you are editing, building inside IDE or from command line, as-if they are provided by the compiler itself.

JetBrains ReSharper InspectCode is also used for wider rule sets. You can run it from PowerShell with .\InspectCode.ps1. Alternatively, you can install ReSharper or use Rider to get inline support in your IDE of choice.

Contributing

When it comes to contributing to the project, the two main things you can do to help out are reporting issues and submitting pull requests. Please refer to the contributing guidelines to understand how to help in the most effective way possible.

If you wish to help with localisation efforts, head over to crowdin.

We love to reward quality contributions. If you have made a large contribution, or are a regular contributor, you are welcome to submit an expense via opencollective. If you have any questions, feel free to reach out to peppy before doing so.

Licence

osu!'s code and framework are licensed under the MIT licence. Please see the licence file for more information. tl;dr you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.

Please note that this does not cover the usage of the "osu!" or "ppy" branding in any software, resources, advertising or promotion, as this is protected by trademark law.

Please also note that game resources are covered by a separate licence. Please see the ppy/osu-resources repository for clarifications.

S
Description
No description provided
Readme 417 MiB
Languages
C# 100%