{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5146","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5146/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5146/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5146/events","html_url":"https://github.com/orientechnologies/orientdb/issues/5146","id":111987721,"number":5146,"title":"Concurrency issue","user":{"login":"gpoirier","id":6423916,"avatar_url":"https://avatars.githubusercontent.com/u/6423916?v=3","gravatar_id":"","url":"https://api.github.com/users/gpoirier","html_url":"https://github.com/gpoirier","followers_url":"https://api.github.com/users/gpoirier/followers","following_url":"https://api.github.com/users/gpoirier/following{/other_user}","gists_url":"https://api.github.com/users/gpoirier/gists{/gist_id}","starred_url":"https://api.github.com/users/gpoirier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gpoirier/subscriptions","organizations_url":"https://api.github.com/users/gpoirier/orgs","repos_url":"https://api.github.com/users/gpoirier/repos","events_url":"https://api.github.com/users/gpoirier/events{/privacy}","received_events_url":"https://api.github.com/users/gpoirier/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/orientechnologies/orientdb/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"laa","id":105066,"avatar_url":"https://avatars.githubusercontent.com/u/105066?v=3","gravatar_id":"","url":"https://api.github.com/users/laa","html_url":"https://github.com/laa","followers_url":"https://api.github.com/users/laa/followers","following_url":"https://api.github.com/users/laa/following{/other_user}","gists_url":"https://api.github.com/users/laa/gists{/gist_id}","starred_url":"https://api.github.com/users/laa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laa/subscriptions","organizations_url":"https://api.github.com/users/laa/orgs","repos_url":"https://api.github.com/users/laa/repos","events_url":"https://api.github.com/users/laa/events{/privacy}","received_events_url":"https://api.github.com/users/laa/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/orientechnologies/orientdb/milestones/64","html_url":"https://github.com/orientechnologies/orientdb/milestones/2.1.x%20(next%20hotfix)","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/milestones/64/labels","id":1282180,"number":64,"title":"2.1.x (next hotfix)","description":"","creator":{"login":"lvca","id":312606,"avatar_url":"https://avatars.githubusercontent.com/u/312606?v=3","gravatar_id":"","url":"https://api.github.com/users/lvca","html_url":"https://github.com/lvca","followers_url":"https://api.github.com/users/lvca/followers","following_url":"https://api.github.com/users/lvca/following{/other_user}","gists_url":"https://api.github.com/users/lvca/gists{/gist_id}","starred_url":"https://api.github.com/users/lvca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvca/subscriptions","organizations_url":"https://api.github.com/users/lvca/orgs","repos_url":"https://api.github.com/users/lvca/repos","events_url":"https://api.github.com/users/lvca/events{/privacy}","received_events_url":"https://api.github.com/users/lvca/received_events","type":"User","site_admin":false},"open_issues":131,"closed_issues":7,"state":"open","created_at":"2015-08-31T15:18:49Z","updated_at":"2015-10-18T18:28:28Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-10-17T22:13:57Z","updated_at":"2015-10-19T05:50:29Z","closed_at":null,"body":"It seems like there's code that's not thread-safe to initialize orientdb. We have several projects that uses it, and I haven't really found the pattern of when the initialization fail and when it doesn't, but when it fails there's two different way. One is the class initializer for `ODatabaseRecordThreadLocal` that throws an exception, and if that happens of course everything is broken.\r\n\r\nThe other scenario that I've seen for the first time today is setupPool on a factory that simply blocks, it never return. In both cases, the work around I've found was to execute the following code before we have any of our code do any interaction with orientdb:\r\n\r\n```\r\n  if (ODatabaseRecordThreadLocal.INSTANCE == null) {\r\n    sys.error(\"Calling this manually normally prevent concurrency issues.\")\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/comments/149108420","html_url":"https://github.com/orientechnologies/orientdb/issues/5146#issuecomment-149108420","issue_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/5146","id":149108420,"user":{"login":"laa","id":105066,"avatar_url":"https://avatars.githubusercontent.com/u/105066?v=3","gravatar_id":"","url":"https://api.github.com/users/laa","html_url":"https://github.com/laa","followers_url":"https://api.github.com/users/laa/followers","following_url":"https://api.github.com/users/laa/following{/other_user}","gists_url":"https://api.github.com/users/laa/gists{/gist_id}","starred_url":"https://api.github.com/users/laa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laa/subscriptions","organizations_url":"https://api.github.com/users/laa/orgs","repos_url":"https://api.github.com/users/laa/repos","events_url":"https://api.github.com/users/laa/events{/privacy}","received_events_url":"https://api.github.com/users/laa/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T05:50:29Z","updated_at":"2015-10-19T05:50:29Z","body":"Sorry but I do not think that you work in correct way with database instance. \r\ngraph and database instances are not thread safe and can not be shared among threads. Do you follow this rule ? :-)"}}