ueshin commented on code in PR #53166:
URL: https://github.com/apache/spark/pull/53166#discussion_r2557526291
##########
python/pyspark/daemon.py:
##########
@@ -78,6 +70,19 @@ def worker(sock, authenticated):
return 1
exit_code = 0
+
+ # We don't know what could happen when we import the worker module. We
have to
+ # guarantee that no thread is spawned before we fork, so we have to import
the
+ # worker module after fork. For example, both pandas and pyarrow starts
some
+ # threads when they are imported.
+ if len(sys.argv) > 1 and sys.argv[1].startswith("pyspark"):
+ import importlib
+
+ worker_module = importlib.import_module(sys.argv[1])
Review Comment:
Just a QQ: Is it ok to call this multiple times? This `worker` function will
be called every UDF execution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]