OSError: Apache/mod_wsgi log object is not associated with a file descriptor

I have a simple Ray program that connect with Ray cluster and executes a remote function.
When I run this program from the command line, it works like a charm. However, when this remote function is called from a Django based web app hosted on Apache2 server using mod_wsgi, I get the following error:
“OSError: Apache/mod_wsgi log object is not associated with a file descriptor.”
Here is the stack trace:

[Tue Jan 26 03:59:02.706384 2021] [wsgi:error] [pid 335920:tid 140665254037248] File “/home/venv/table_creator.py”, line 23, in init
[Tue Jan 26 03:59:02.706396 2021] [wsgi:error] [pid 335920:tid 140665254037248] ray.init(address=‘auto’)
[Tue Jan 26 03:59:02.706422 2021] [wsgi:error] [pid 335920:tid 140665254037248] File “/home/venv/lib/python3.8/site-packages/ray/worker.py”, line 766, in init
[Tue Jan 26 03:59:02.706435 2021] [wsgi:error] [pid 335920:tid 140665254037248] connect(
[Tue Jan 26 03:59:02.706461 2021] [wsgi:error] [pid 335920:tid 140665254037248] File “/home/venv/lib/python3.8/site-packages/ray/worker.py”, line 1080, in connect
[Tue Jan 26 03:59:02.706472 2021] [wsgi:error] [pid 335920:tid 140665254037248] faulthandler.enable(all_threads=False)
[Tue Jan 26 03:59:02.706526 2021] [wsgi:error] [pid 335920:tid 140665254037248] OSError: Apache/mod_wsgi log object is not associated with a file descriptor.

Any help how to solve this please?
Thank you.

If you can produce a self-contained, reproducible script that will be greatly appreciated! Otherwise just by looking at the error it’s a bit hard to figure out what’s going on. @sangcho it looks like we are trying to retrieve the logger provided by django/mod_wsgi and their logger isn’t compatible with Ray?

Hi Simon,
Thanks for your reply. It is really a very simple test program that we wanted to execute to see how this works. Here is the code:

class Parallel():
def __init__(self):
    ray.init(address="auto")
@ray.remote
def getCellContent(self, row):
   return "x"

parallel = Parallel()
future_rows = [parallel.getCellContent.remote(row) for count, row in df.iterrows()]
print(ray.get(future_rows))

What version of Ray are you using? Also, can you create an issue to our Github issue page? Issues · ray-project/ray · GitHub

I have created an issue to the github page. Here is some additional information:
Python: 3.8
OS: Ubuntu 20.4
Ray: 1.1.0
Tensorflow: 2.3.0

Thank you,