Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
svetlyak40wt opened this issue Jan 15, 2023 · 14 comments
Open

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

svetlyak40wt opened this issue Jan 15, 2023 · 14 comments

Comments

@svetlyak40wt
Copy link

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
Copy link

triscuitcircuit commented Jan 17, 2023

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
Copy link
Author

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: #11 (comment)

@Shinmera
Copy link
Member

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
Copy link
Author

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
Copy link
Member

Shinmera commented Jan 17, 2023

Well get a backtrace, first of all.

@svetlyak40wt
Copy link
Author

svetlyak40wt commented Jan 17, 2023

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
Copy link
Author

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
Copy link

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

@svetlyak40wt
Copy link
Author

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

@svetlyak40wt
Copy link
Author

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
Copy link
Member

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

@Shinmera
Copy link
Member

@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
Copy link
Author

svetlyak40wt commented Jan 19, 2023 via email

@Shinmera
Copy link
Member

Shinmera commented Mar 22, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants