diff --git a/README.md b/README.md index 8bb0c7072..389f89215 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ minioClient = Minio('play.min.io', secure=True) ``` +**NOTE on concurrent usage:** The `Minio` object is thread safe when using the Python `threading` library. Specifically, it is **NOT** safe to share it between multiple processes, for example when using `multiprocessing.Pool`. The solution is simply to create a new `Minio` object in each process, and not share it between processes. + ## Quick Start Example - File Uploader This example program connects to a MinIO object storage server, makes a bucket on the server and then uploads a file to the bucket. diff --git a/docs/API.md b/docs/API.md index 279a12c18..40194e480 100644 --- a/docs/API.md +++ b/docs/API.md @@ -64,6 +64,8 @@ __Parameters__ | `region` |_string_ | Set this value to override automatic bucket location discovery. (Optional defaults to `None`). | | `http_client` |_urllib3.poolmanager.PoolManager_ | Set this value to use custom http client instead of using default http client. (Optional defaults to `None`) | +**NOTE on concurrent usage:** The `Minio` object is thread safe when using the Python `threading` library. Specifically, it is **NOT** safe to share it between multiple processes, for example when using `multiprocessing.Pool`. The solution is simply to create a new `Minio` object in each process, and not share it between processes. + __Example__ ### MinIO diff --git a/minio/api.py b/minio/api.py index a6c3bbabd..e6bd6473a 100644 --- a/minio/api.py +++ b/minio/api.py @@ -144,6 +144,13 @@ class Minio(object): :param timeout: Set this value to control how long requests are allowed to run before being aborted. :return: :class:`Minio ` object + + **NOTE on concurrent usage:** The `Minio` object is thread safe when using + the Python `threading` library. Specifically, it is **NOT** safe to share + it between multiple processes, for example when using + `multiprocessing.Pool`. The solution is simply to create a new `Minio` + object in each process, and not share it between processes. + """ def __init__(self, endpoint, access_key=None, secret_key=None,