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

OSError when serving simple panel app with --num-procs and --setup #6891

Open
1 task done
duarteocarmo opened this issue Jun 4, 2024 · 7 comments · May be fixed by #6913
Open
1 task done

OSError when serving simple panel app with --num-procs and --setup #6891

duarteocarmo opened this issue Jun 4, 2024 · 7 comments · May be fixed by #6913
Labels
type: bug Something isn't correct or isn't working

Comments

@duarteocarmo
Copy link

duarteocarmo commented Jun 4, 2024

ALL software version info

(.env) [duarteocarmo:~/Repos/panel-bug]$ sw_vers                                                                                                                                            
ProductName:            macOS
ProductVersion:         14.4.1
BuildVersion:           23E224
(.env) [duarteocarmo:~/Repos/panel-bug]$ pip freeze | grep 'panel'                                                                                                                          
panel==1.4.4
(.env) [duarteocarmo:~/Repos/panel-bug]$ python                                                                                                                                             
Python 3.10.11 (main, May 12 2023, 08:35:23) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin

Description of expected behavior and the observed behavior

When running panel serve with both the --setup and --num-procs.

However, when running the app with either the num-procs or setupoptions isolated, it works. When combined, I get this error.

panel serve app.py --setup background-job.py --num-procs 2

I receive the following error:

(.env) [duarteocarmo:~/Repos/panel-bug]$ panel serve app.py --setup background-job.py --num-procs 2                                                                                         
2024-06-04 15:06:37,885 Starting Bokeh server version 3.4.1 (running on Tornado 6.4)
2024-06-04 15:06:37,887 User authentication hooks NOT provided (default user enabled)
2024-06-04 15:06:37,893 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:06:37,893 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:06:38,072 child 0 (pid 43398) exited with status 1, restarting
2024-06-04 15:06:38,075 child 1 (pid 43399) exited with status 1, restarting
2024-06-04 15:06:38,079 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:06:38,079 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:06:38,235 child 1 (pid 43401) exited with status 1, restarting

Complete, minimal, self-contained example code that reproduces the issue

# app.py
import panel as pn


pn.pane.Markdown("Hello World").servable()
# background_job.py
from datetime import datetime

import panel as pn

current_time = datetime.now()

def task() -> None:
    """Refresh the data in the database."""
    print("Ran task")

pn.state.schedule_task(name="load_data", callback=task, at=current_time, period="2m")

Now run:

panel serve app.py --setup background-job.py --num-procs 2

Stack traceback and/or browser JavaScript console output

2024-06-04 15:09:51,223 Starting Bokeh server version 3.4.1 (running on Tornado 6.4)
2024-06-04 15:09:51,224 User authentication hooks NOT provided (default user enabled)
2024-06-04 15:09:51,230 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:09:51,230 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:09:51,392 child 1 (pid 46545) exited with status 1, restarting
2024-06-04 15:09:51,397 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:09:51,399 child 0 (pid 46544) exited with status 1, restarting
2024-06-04 15:09:51,403 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:09:51,555 child 0 (pid 46547) exited with status 1, restarting
2024-06-04 15:09:51,559 child 1 (pid 46546) exited with status 1, restarting
2024-06-04 15:09:51,562 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
2024-06-04 15:09:51,564 Cannot start Bokeh server [EBADF]: OSError(9, 'Bad file descriptor')
  • I may be interested in making a pull request to address this (if given some guidance)
@hoxbro
Copy link
Member

hoxbro commented Jun 7, 2024

I can't recreate the error, but I also don't get any print statement. Or exceptions if I change the print statement to an exception.

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label Jun 7, 2024
@duarteocarmo
Copy link
Author

@hoxbro weird… you are also on MacOS?

@hoxbro
Copy link
Member

hoxbro commented Jun 7, 2024

Tried both on Linux and macOS, I was running on main and with Python 3.12.

@philippjfr
Copy link
Member

Seems like someone else encountered this in a slightly different setup: #5930

@duarteocarmo
Copy link
Author

Huuum…

@duarteocarmo
Copy link
Author

@philippjfr and @hoxbro, it looks like it works with Python 3.12...

@duarteocarmo
Copy link
Author

@philippjfr , @hoxbro , update. With python 3.12 it does not raise an error, but the --setup does not run on start.

@hoxbro hoxbro linked a pull request Jun 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants