{"action":"created","issue":{"url":"https://api.github.com/repos/brian-team/brian2/issues/463","labels_url":"https://api.github.com/repos/brian-team/brian2/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/brian-team/brian2/issues/463/comments","events_url":"https://api.github.com/repos/brian-team/brian2/issues/463/events","html_url":"https://github.com/brian-team/brian2/issues/463","id":73874117,"number":463,"title":"Race condition in weave_rt?","user":{"login":"dabliss","id":882563,"avatar_url":"https://avatars.githubusercontent.com/u/882563?v=3","gravatar_id":"","url":"https://api.github.com/users/dabliss","html_url":"https://github.com/dabliss","followers_url":"https://api.github.com/users/dabliss/followers","following_url":"https://api.github.com/users/dabliss/following{/other_user}","gists_url":"https://api.github.com/users/dabliss/gists{/gist_id}","starred_url":"https://api.github.com/users/dabliss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dabliss/subscriptions","organizations_url":"https://api.github.com/users/dabliss/orgs","repos_url":"https://api.github.com/users/dabliss/repos","events_url":"https://api.github.com/users/dabliss/events{/privacy}","received_events_url":"https://api.github.com/users/dabliss/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brian-team/brian2/labels/upstream-bug","name":"upstream-bug","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-07T07:07:15Z","updated_at":"2015-05-08T06:59:34Z","closed_at":null,"body":"Hey brian2 team,\r\n\r\nI sent an email to the brian2 mailing list about the following warning I'd been getting:\r\n\r\n    WARNING  brian2.codegen.runtime.weave_rt.weave_rt.failed_compile_test: Cannot use weave, a test compilation failed: invalid syntax (<string>, line 1) (SyntaxError)\r\n\r\nIt turns out this is pointing to a more serious issue than we originally thought (I think).  In addition to these warnings, I'm now getting occasional uncaught `SyntaxError`s.  All of the errors originate in calls to `weave.inline` in `brian2/codegen/runtime/weave_rt/weave_rt.py`.\r\n\r\nI've dug into the `scipy` source code (version 0.15.1), and it appears that calls to `inline` make use of a set of cache files, which for me have the following paths:\r\n\r\n    ~/.cache/scipy/python27_compiled/linux227compiled_catalog.bak\r\n    ~/.cache/scipy/python27_compiled/linux227compiled_catalog.dat\r\n    ~/.cache/scipy/python27_compiled/linux227compiled_catalog.dir\r\n\r\nMy errors and warnings seem to occur when multiple simultaneous `brian2` simulations try to read from and write to these cache files at the same time.  Simultaneous writing introduces syntax errors -- i.e., each line is no longer valid python code -- and subsequent reading, followed by an attempted evaluation of the python code, raises the errors.\r\n\r\nI'm not sure whether this is a problem for `brian2`, a problem for `scipy`, or a problem for me.  I suppose what is needed is for use of these cache files to be circumvented.  (But wouldn't this come with a speed penalty?)"},"comment":{"url":"https://api.github.com/repos/brian-team/brian2/issues/comments/100127976","html_url":"https://github.com/brian-team/brian2/issues/463#issuecomment-100127976","issue_url":"https://api.github.com/repos/brian-team/brian2/issues/463","id":100127976,"user":{"login":"mstimberg","id":1381982,"avatar_url":"https://avatars.githubusercontent.com/u/1381982?v=3","gravatar_id":"","url":"https://api.github.com/users/mstimberg","html_url":"https://github.com/mstimberg","followers_url":"https://api.github.com/users/mstimberg/followers","following_url":"https://api.github.com/users/mstimberg/following{/other_user}","gists_url":"https://api.github.com/users/mstimberg/gists{/gist_id}","starred_url":"https://api.github.com/users/mstimberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstimberg/subscriptions","organizations_url":"https://api.github.com/users/mstimberg/orgs","repos_url":"https://api.github.com/users/mstimberg/repos","events_url":"https://api.github.com/users/mstimberg/events{/privacy}","received_events_url":"https://api.github.com/users/mstimberg/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T06:59:34Z","updated_at":"2015-05-08T06:59:34Z","body":"This a known limitation of weave, its database is not built for concurrent access. In principle it could work to make weave use different directories for different process (by setting the `PYTHONCOMPILED` and/or `XDG_CACHE_HOME` environment variable), but in a quick test I could not get it to work.\r\nI don't think there's much we can do here from the Brian side (except for documenting the issue)."}}