Shirakumo / kandria

A post-apocalyptic actionRPG. Now on Steam!
https://kandria.com
zlib License
620 stars 30 forks source link

[OSX] Error in render thread Syscall select(2) failed on fd 0 #12

Open svetlyak40wt opened 1 year ago

svetlyak40wt commented 1 year ago

After solving issue with libvorbis I still see the black screen.

Probably because of the error about select:

2023-01-15 14:38:57 [SEVERE] <TRIAL.RENDER-LOOP>: Error in render thread Syscall select(2) failed on fd 0: Bad file descriptor

or probably because of other errors (about failed attempt to fetch news or problem with duplicate symbols from different pages.

here is the full log:

2023-01-15 14:38:48 [INFO ] <TRIAL.MAIN>: Scene setup took 0.208583s run time, 0.217893s clock time.
2023-01-15 14:38:49 [INFO ] <TRIAL.LOADER>: Loading about 2 resources.
2023-01-15 14:38:49 [INFO ] <TRIAL.LOADER>: Loading about 2 resources.
2023-01-15 14:38:50 [INFO ] <TRIAL.LOADER>: Loading about 192 resources.
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class #<STANDARD-CLASS KANDRIA::SPLITS-LAYOUT>:
       (KANDRIA::CELL-MARGINS ORG.SHIRAKUMO.ALLOY:CELL-MARGINS)
2023-01-15 14:38:51 [INFO ] <TRIAL.MAIN>: Commit took 2.157918s run time, 2.944071s clock time.
2023-01-15 14:38:51 [INFO ] <TRIAL.LOADER>: Loading about 4 resources.
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class
   #<STANDARD-CLASS ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF:TEXT>:
       (ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF::MARKUP
        ORG.SHIRAKUMO.ALLOY.RENDERERS.SIMPLE:MARKUP)
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class
   #<STANDARD-CLASS ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF:TEXT>:
       (ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF::MARKUP
        ORG.SHIRAKUMO.ALLOY.RENDERERS.SIMPLE:MARKUP)
2023-01-15 14:38:51 [INFO ] <TRIAL.CONTEXT>: #<THREAD "main thread" RUNNING {70051B14F3}> releasing #<CONTEXT {70036C0AF3}>.
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/tundra.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/subway.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/region3.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/region2.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/region1.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/debug.ase
2023-01-15 14:38:51 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/tileset/camp.ase
2023-01-15 14:38:52 [ERROR] <TRIAL.NOTIFY>: Failed to add watch for /Users/art/Downloads/kandria-windows/pool/kandria/sprite/door-burst.ase
2023-01-15 14:38:52 [SEVERE] <TRIAL.ACHIEVEMENTS>: Failed to load achievement data from #<ACHIEVEMENT-API {700753A833}> Not connected to steam.
2023-01-15 14:38:52 [INFO ] <TRIAL.CONTEXT>: #<THREAD "render-loop" RUNNING {70086384E3}> acquiring #<CONTEXT {70036C0AF3}>.
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class #<STANDARD-CLASS KANDRIA::SPLITS-LAYOUT>:
       (KANDRIA::CELL-MARGINS ORG.SHIRAKUMO.ALLOY:CELL-MARGINS)
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class
   #<STANDARD-CLASS ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF:TEXT>:
       (ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF::MARKUP
        ORG.SHIRAKUMO.ALLOY.RENDERERS.SIMPLE:MARKUP)
2023-01-15 14:38:52 [INFO ] <TRIAL.INPUT>: Detected the following controllers:
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class
   #<STANDARD-CLASS ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF:TEXT>:
       (ORG.SHIRAKUMO.ALLOY.RENDERERS.OPENGL.MSDF::MARKUP
        ORG.SHIRAKUMO.ALLOY.RENDERERS.SIMPLE:MARKUP)
STYLE-WARNING:
   slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
   package problem) for class #<STANDARD-CLASS KANDRIA::SPLITS-LAYOUT>:
       (KANDRIA::CELL-MARGINS ORG.SHIRAKUMO.ALLOY:CELL-MARGINS)

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "render-loop" RUNNING {70157A00E3}>:
  Syscall select(2) failed on fd 0: Bad file descriptor

The current thread is not at the foreground,
SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD "main thread" RUNNING {70051B14F3}>
for this thread to enter the debugger.
2023-01-15 14:38:57 [INFO ] <KANDRIA.NEWS>: Fetching news...
2023-01-15 14:38:57 [SEVERE] <TRIAL.RENDER-LOOP>: Error in render thread Syscall select(2) failed on fd 0: Bad file descriptor
2023-01-15 14:38:58 [SEVERE] <KANDRIA.NEWS>: Failed to fetch news: A failure in the SSL library occurred on handle #.(SB-SYS:INT-SAP #X12906D800) (return code: 1). ERR_print_errors(): 0070AD6F01000000:error:0A000126:SSL routines:ssl3_read_n:unexpected eof while reading:ssl/record/rec_layer_s3.c:321:

2023-01-15 14:39:04 [INFO ] <TRIAL.BACKEND.GLFW>: Window has been iconified
2023-01-15 14:39:04 [INFO ] <TRIAL.BACKEND.GLFW>: Window has lost focus
2023-01-15 14:39:30 [INFO ] <TRIAL.BACKEND.GLFW>: Window has gained focus
2023-01-15 14:39:30 [INFO ] <TRIAL.BACKEND.GLFW>: Window has been restored
2023-01-15 14:39:33 [INFO ] <TRIAL.BACKEND.GLFW>: Window has been iconified
triscuitcircuit commented 1 year ago

What did you do to get to that point? Im encountering an issue with "action-list" and the references to it, even when using the "action-list" library from Github. I then re-ran the (load "setup.lisp") after I deleted my sbcl cache of both "action-list" and "kandria" (in case I allowed a error to continue). Which still results in the error:

#<THREAD "main thread" RUNNING {70063C0523}>:
  While computing the class precedence list of the class named ORG.SHIRAKUMO.FRAF.ACTION-LIST:ACTION-LIST.
The class named ORG.SHIRAKUMO.TRIVIAL-EXTENSIBLE-SEQUENCES:SEQUENCE is a forward referenced class.
The class named ORG.SHIRAKUMO.TRIVIAL-EXTENSIBLE-SEQUENCES:SEQUENCE is a direct superclass of the class named ORG.SHIRAKUMO.FRAF.ACTION-LIST:ACTION-LIST.

(also "OSX" is for MacOs 10. the Current MacOs is version 13 )

svetlyak40wt commented 1 year ago

I skipped setup.lisp, only created a .install file in local directory.

Then created qlfile with following content (I'm using Qlot to pin libs versions):

dist shirakumo http://dist.shirakumo.org/shirakumo.txt

and run qlot update:

After that I started SBCL REPL:

qlot exec ros emacs

It runs Roswell inside local Qlot environment and Roswell starts SBCL.

After that, in the REPL I'm doing:

(push "quest/" asdf:*central-registry*)
(ql:quickload :kandria)
(kandria:launch)

But also, I patched cl-vorbis to get around this bug on M1 chip. Patch is here: https://github.com/Shirakumo/kandria/issues/11#issuecomment-1383127642

Shinmera commented 1 year ago

The warnings about duplicate symbols are just SBCL being annoying and don't mean anything. Fetching the news erroring out also doesn't mean anything.

svetlyak40wt commented 1 year ago

So, the problem is in the

2023-01-15 14:38:57 [SEVERE] <TRIAL.RENDER-LOOP>: Error in render thread Syscall select(2) failed on fd 0: Bad file descriptor

?

What is the best way to debug what is happening there?

Shinmera commented 1 year ago

Well get a backtrace, first of all.

svetlyak40wt commented 1 year ago

Don't know what I've did (besides attaching to the game from Emacs via SLY), but the game started on my Mac. However, sometimes errors like this:

Error opening #P"/dev/urandom": Too many open files

or

Error opening #P"/Users/art/Downloads/kandria-windows/pool/kandria/sprite/active-item.png":

  Too many open files

popup in the debugger.

I've checked how many files are opened by the process and it is only about 150.

Retrying helps to load them.

svetlyak40wt commented 1 year ago

Also, sometimes this error popups:

The value
  NIL
is not of type
  SB-SYS:SYSTEM-AREA-POINTER
when binding SB-ALIEN::VALUE
   [Condition of type TYPE-ERROR]

Restarts:
 0: [RESET-RENDER-LOOP] Reset the render loop timing, not catching up with lost frames.
 1: [EXIT-RENDER-LOOP] Exit the render loop entirely.
 2: [ABORT] abort thread (#<THREAD "render-loop" RUNNING {7005270B43}>)

Backtrace:
 0: (TRIAL::PING-POWERSAVE 20.01999955251813d0)
 1: ((SB-PCL::EMF TRIAL:UPDATE) #<unused argument> #<unused argument> #<KANDRIA::MAIN {7005210053}> 20.01999955251813d0 0.01 4785)
 2: ((:METHOD TRIAL:RENDER-LOOP (TRIAL:RENDER-LOOP)) #<KANDRIA::MAIN {7005210053}>) [fast-method]
 3: ((:METHOD TRIAL:RENDER-LOOP :AROUND (TRIAL:DISPLAY)) #<KANDRIA::MAIN {7005210053}>) [fast-method]
 4: ((:METHOD TRIAL:RENDER-LOOP :AROUND (KANDRIA::MAIN)) #<KANDRIA::MAIN {7005210053}>) [fast-method]
 5: ((LAMBDA NIL :IN TRIAL:START))
 6: ((LAMBDA NIL :IN TRIAL:MAKE-THREAD))
 7: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
triscuitcircuit commented 1 year ago

Interesting... are you on the Discord by chance?

svetlyak40wt commented 1 year ago

No. I have a Telegram. Nick is the same as on GitHub.

svetlyak40wt commented 1 year ago

Also, I've found the total number of opened files in the whole OS is about 7300, which is not high. (calculated as lsof -n | cut -f1 -d' ' | uniq -c | sort | awk '{print $1}' | pbcopy and then summing in repl).

And per process openfiles limit is 256 (twice higher than actual Kandria process number):

launchctl limit maxfiles
Shinmera commented 1 year ago

Can you give me traces for the too many open files error?

Shinmera commented 1 year ago

@svetlyak40wt Could you PR to cl-mixed similar to how you did for cl-vorbis so we have an M1 binary there, too? Thanks!

svetlyak40wt commented 1 year ago

Sure. Thank you for the reminder. Will do this tomorrow.

чт, 19 янв. 2023 г., 21:17 Nicolas Hafner @.***>:

@svetlyak40wt https://github.com/svetlyak40wt Could you PR to cl-mixed similar to how you did for cl-vorbis so we have an M1 binary there, too? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/Shirakumo/kandria/issues/12#issuecomment-1397412917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGB66DE3IML7QG5DGASPTWTGAKVANCNFSM6AAAAAAT32FH5A . You are receiving this because you were mentioned.Message ID: @.***>

Shinmera commented 1 year ago

You can get around the too many open files error by removing #-kandria-release org.shirakumo.fraf.trial.notify:main from main.lisp

It looks like the file-notify library is bugged on macos.