diff --git a/docs/src/troubleshooting.md b/docs/src/troubleshooting.md index 595753d6..4210c820 100644 --- a/docs/src/troubleshooting.md +++ b/docs/src/troubleshooting.md @@ -8,6 +8,10 @@ For trouble shooting, the best place to ask is in our Discord, under the relevan language channel. By asking in the language-specific channel, it makes it more likely that someone who knows the answer will see your question. +## Common issues + +* Multiprocessing with `fork` is not supported. You should use `spawn` instead. + ## Enabling logging To provide more information, especially for LanceDB Cloud related issues, enable diff --git a/python/python/lancedb/__init__.py b/python/python/lancedb/__init__.py index 5eff9638..03f4f513 100644 --- a/python/python/lancedb/__init__.py +++ b/python/python/lancedb/__init__.py @@ -7,6 +7,7 @@ import os from concurrent.futures import ThreadPoolExecutor from datetime import timedelta from typing import Dict, Optional, Union, Any +import warnings __version__ = importlib.metadata.version("lancedb") @@ -213,3 +214,13 @@ __all__ = [ "RemoteDBConnection", "__version__", ] + + +def __warn_on_fork(): + warnings.warn( + "lance is not fork-safe. If you are using multiprocessing, use spawn instead.", + ) + + +if hasattr(os, "register_at_fork"): + os.register_at_fork(before=__warn_on_fork)