GithubHelp home page GithubHelp logo

Comments (17)

plutooo avatar plutooo commented on May 20, 2024

can you narrow down what error resulted in this panic?

from libnx.

 avatar commented on May 20, 2024

I am not certain; for nx-hbmenu, the issue was introduced with the UI update; it seems that anything with "complex" graphics is more liable to cause this crash. Also potentially notable is, if you manage to launch an NRO from nx-hbmenu before it crashes, the application itself will eventually crash with the same 2345-0021 error that the hbmenu itself usually does, whereas it would not have crashed if loaded directly.

from libnx.

yellows8 avatar yellows8 commented on May 20, 2024

Are you able to modify libnx gfx.c to determine the error trigger? "loaded directly" ?

from libnx.

 avatar commented on May 20, 2024

I've not been successful at pinpointing the exact problem, but upon further testing I noticed that the 1.0 version of nx-hbmenu is not subject to these crashes. As for "loaded directly", I meant loading an NSP directly with nspwn.

from libnx.

yellows8 avatar yellows8 commented on May 20, 2024

"Are you able to modify libnx gfx.c to determine the error trigger?"

(Just write to a file with stdio)

from libnx.

 avatar commented on May 20, 2024

Sorry for the slow replies. It seems Swiftloke beat me to doing this; here's a log of the #switchdev conversation for posterity:

<Swiftloke> I've done a little bit of digging with my 1.0.0 Switch, and managed to backtrace to the BadGfxDequeueError and where it occurs.
<Swiftloke> The error is LibnxNvidiaError_InsufficientMemory.
<yellows8> what returns that?
<Swiftloke> The error originally sprouts up here:
<Swiftloke> https://github.com/switchbrew/libnx/blob/1e04b22bae5eb3fd89783b6bd5b3cbf1c08a9365/nx/source/gfx/nvgfx.c#L426
<Swiftloke> Then it's carried down here:
<Swiftloke> https://github.com/switchbrew/libnx/blob/3a8a9d7c2695294845464a1eea68800005425e7a/nx/source/gfx/gfx.c#L142
<Swiftloke> Then to here:
<Swiftloke> https://github.com/switchbrew/libnx/blob/3a8a9d7c2695294845464a1eea68800005425e7a/nx/source/gfx/gfx.c#L517
<yellows8> ok :/

from libnx.

yellows8 avatar yellows8 commented on May 20, 2024

Try with: 726f8ad

from libnx.

Swiftloke avatar Swiftloke commented on May 20, 2024

Several tests with this commit yield success- hbmenu 2.0 no longer crashes on startup. I'll be trying more various homebrew and reporting back.

from libnx.

 avatar commented on May 20, 2024

Yeah, likewise here. As I mentioned in #switchdev, seems the issue is resolved, at least with nx-hbmenu.

from libnx.

Swiftloke avatar Swiftloke commented on May 20, 2024

Posting this for historical reasons. As an update to my earlier debugging, it turns out that the error was due to improper handling of the LibnxNvidiaError_Timeout error, and not something running out of memory, see below:

Swiftloke 15:37:19
Well, it works on 1.0.0. It was a failure to handle the timeout error correctly, then?
@yellows8 15:38:23
yeah
Swiftloke 15:38:41
So why did it end up throwing InsufficientMemory then...?
Huh.
@yellows8 15:39:15
was it *really* InsufficientMemory?
Swiftloke 15:39:47
OK...
So... The error actually shown in fatal was off by one in the corresponding result.h error. I figured this out about halfway through debugging, after I had decided what the error was.
So it was Timeout.

from libnx.

jarulo avatar jarulo commented on May 20, 2024

I am using the suggested commit fix at 726f8ad but I still get a libnx crash with the same error.

More specifically, nvgfxEventWait is returning 0xF5C, which is LibnxNvidiaError_InsufficientMemory if I am reading this correctly. Any ideas how this can happen?

(FWIW, also only seems to happen on 1.0.0)

from libnx.

yellows8 avatar yellows8 commented on May 20, 2024

Can you try with libnx 1.2.1?

from libnx.

jarulo avatar jarulo commented on May 20, 2024

Still same error on libnx 1.2.1.

I fixed it by adding this:

Result nvgfxEventWait(u32 syncpt_id, u32 threshold, s32 timeout) {
    Result rc=0;
    Result timeout_rc = MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_Timeout);
    Result insufficientmemory_rc = MAKERESULT(Module_LibnxNvidia, LibnxNvidiaError_InsufficientMemory);

    if (R_SUCCEEDED(rc)) {
        do {
            rc = nvioctlNvhostCtrl_EventWait(g_nvgfx_fd_nvhostctrl, syncpt_id, threshold, timeout, 0, &g_nvgfx_nvhostctrl_eventres);
        } while(rc==timeout_rc || rc == insufficientmemory_rc);
    } 

The insufficient memory error does not seem to be fatal as just retrying seems to make it go away.

from libnx.

yellows8 avatar yellows8 commented on May 20, 2024

What code did you use to obtain that 0xF5C error, and are you sure it's correct?

from libnx.

jarulo avatar jarulo commented on May 20, 2024

I used UART to print the errorcodes that are not timeout_rc and not 0. Only the 0xF5C error popped up once in a while. It happens very rarely and only very early on application start, but if it happened, it was fatal.

from libnx.

Cpasjuste avatar Cpasjuste commented on May 20, 2024

Hi,

My latest version of pfba does have the same error randomly (after loading multiple times a rom). I guess it could be a problem on my side. I'm using latest libnx sources, and i'm on 5.1 since a few days. Not sure what causing the problem (libnx, some pfba changes, the 5.1 update..).
I'm going to take a closer look to see where it really crash.

from libnx.

Cpasjuste avatar Cpasjuste commented on May 20, 2024

Hi,
For information, i fixed my crash with this commit : Cpasjuste/libcross2dui@b347921#diff-c9a7f53fde38976bb82d1b09304cc1b5

from libnx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.