man-group / ArcticDB

ArcticDB is a high performance, serverless DataFrame database built for the Python Data Science ecosystem.
http://arcticdb.io
Other
1.5k stars 93 forks source link

Unexpected warning when opening LMDB with nohup #1033

Closed river7816 closed 9 months ago

river7816 commented 1 year ago

Describe the bug

I use nohup to run the python file

(rqsdk) yefei@yefei:~/river$ nohup python read_from_arcticdb.py > output.log 2>&1 &
[1] 5333

and get

[2023-11-04 17:38:33.475] [arcticdb] [warning] LMDB path at /home/yefei/Database/ has already been opened in this process which is not supported by LMDB. You should only open a single Arctic instance over a given LMDB path. To continue safely, you should delete this Arctic instance and any others over the LMDB path in this process and then try again. Current process ID=[5333]

Steps/Code to Reproduce

import pandas as pd
from read_from_arcticdb import save_list_to_pickle, load_list_from_pickle
from rqdatac import *
import rqdatac as rq
from tqdm import tqdm
from arcticdb import Arctic
import gc
rq.init('18964677307','123456')
ac = Arctic('lmdb:///home/yefei/Database?map_size=900GB')
lib = ac['FinancialData']
dates = load_list_from_pickle('dates.pkl')
stock = load_list_from_pickle('stocks.pkl')

Expected Results

No warning is thrown

OS, Python Version and ArcticDB Version

Python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] OS: Linux-6.2.0-34-generic-x86_64-with-glibc2.35 ArcticDB: 4.1.0

Backend storage used

LMDB

Additional Context

No response

joe-iddon commented 1 year ago

Hi @river7816 thank you for your report. We recently introduced a warning if the same LMDB database is opened twice from two separate Arctic instances. See #1000 .

Please could you post a fully reproducible snippet if you think that you are only opening the database once and the error is incorrect? e.g. what does load_list_from_pickle do?

muhammadhamzasajjad commented 9 months ago

@river7816, as @joe-iddon said, you shouldn't get this error if you open only one connection to an LMDB database. I have tried to reproduce the bug using the provided code (except the last two lines as I don't have access to the pickle files). But the warning did not trigger as only one connection to the LMDB is opened.

The warning would trigger if you open connection/s to LMDB from your load_list_from_pickle function using a new Arctic instance. Please provide full code for reproducing the bug.