-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to open a second instance of IPython #1342
Comments
I can't seem to trigger this on purpose, but I think I understand what could cause the issue. What platform are you on, and is your home directory mounted via NFS or other network share? |
I suspect it's a lock on the sqlite history database, but I've also never seen it. @takluyver, have you ever encountered this one? |
@minrk is right: my home is on NFS. I'm running Fedora Core 16. |
This is your problem then: http://www.sqlite.org/faq.html#q5. SQLite locking doesn't work reliably on NFS filesystems. Your best bet is to start ipython directing it to use a local file for history:
Just use a path that is not NSF mounted. You can set this variable permanently in your config file if you find a value that works well. I don't know that we can really do anything else on our end, since the problem is really beyond ipython's reach. |
Ah. Sounds good. In the config file, is it: c = get_config() ? Thanks! |
On 29 January 2012 23:41, Juan Nunez-Iglesias <
That should be it, yes. Thomas |
I also ran into this issue... I instantiate an InteractiveShell object during module initialisation in order to register a custom tab completer: from IPython.core.interactiveshell import InteractiveShell This module is imported by multiple processes that start up in parallel, leading to a race condition where some of the processes may hang on the reported OperationalError exception. I am using an SQLite history database on an HFS+ filesystem on a Mac (so no NFS problems here). Any ideas or workarounds would be welcomed. |
If you don't actually need to access the history, you can override the config to use an in-memory database: from IPython.config.loader import Config
from IPython.core.interactiveshell import InteractiveShell
cfg = Config()
cfg.HistoryManager.hist_file = ':memory:'
ip = InteractiveShell.instance(config=cfg) which presumably wouldn't have multiprocessing issues. |
Thanks, That's very useful to know. In the end I opted to just catch the OperationalError exception and ignore the tab completer in that case, as this race condition typically occurs in system processes with no need for user interaction. The problem is that our code supports IPython 0.10, 0.11 and 0.12, and your code seems to be 0.12 only (if I consider your pull request 940). I already have two code paths for 0.10 and 0.11+ and want to avoid yet another code path... |
Well, using How many processes do you have starting up in parallel? I'm a bit surprised it has a problem with this, but maybe if there are a lot of processes, it's just the sheer number trying to access the database that causes it. |
We have in the order of 10 processes starting up. Every now and then (more then than now, it seems), 2-3 processes will lock up with this error. Of course, I cannot reproduce it now after several startup attempts in order to verify this :-) |
I am getting the following error when trying to open a new iPython instance:
This happens when the other iPython session is executing a particularly lengthy command, but not when it is idle. When I try to run something inside an already open session while a command is running in a separate session, I get:
The cause is obvious, but it seems to me that the functionality is broken... History commands generated while the db is locked should probably be added to a queue to be submitted once the lock is removed.
The text was updated successfully, but these errors were encountered: