{"action":"created","issue":{"url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/122","repository_url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader","labels_url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/122/comments","events_url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/122/events","html_url":"https://github.com/ExcelDataReader/ExcelDataReader/issues/122","id":158850410,"number":122,"title":"The LogManager is not thread safe","user":{"login":"thriolsson","id":16080236,"avatar_url":"https://avatars.githubusercontent.com/u/16080236?v=3","gravatar_id":"","url":"https://api.github.com/users/thriolsson","html_url":"https://github.com/thriolsson","followers_url":"https://api.github.com/users/thriolsson/followers","following_url":"https://api.github.com/users/thriolsson/following{/other_user}","gists_url":"https://api.github.com/users/thriolsson/gists{/gist_id}","starred_url":"https://api.github.com/users/thriolsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thriolsson/subscriptions","organizations_url":"https://api.github.com/users/thriolsson/orgs","repos_url":"https://api.github.com/users/thriolsson/repos","events_url":"https://api.github.com/users/thriolsson/events{/privacy}","received_events_url":"https://api.github.com/users/thriolsson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-07T06:42:23Z","updated_at":"2016-06-08T08:28:19Z","closed_at":null,"body":"The static class LogManager is not thread safe. It uses a Dictionary, but it is accessed outside the lock.\r\nThe Dictionary class is not tread safe. It is not safe to write **or read** from Dictionary class in parallell.\r\n\"Double checking\" makes the odds better, but there is still an issue!\r\n\r\n```\r\npublic static ILog Log(string objectName)\r\n{\r\n    ILog result = null;\r\n\r\n    if (_dictionary.ContainsKey(objectName))\r\n        result = _dictionary[objectName];\r\n\r\n    if (result == null)\r\n    {\r\n        lock (_sync)\r\n        {\r\n                if (_dictionary.ContainsKey(objectName))\r\n                {\r\n                        result = _dictionary[objectName];\r\n                }\r\n                else\r\n                {\r\n                        result = Excel.Log.Log.GetLoggerFor(objectName);\r\n                      _dictionary.Add(objectName, result);\r\n                }\r\n\r\n               result = _dictionary[objectName];\r\n        }\r\n    }\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/comments/224522889","html_url":"https://github.com/ExcelDataReader/ExcelDataReader/issues/122#issuecomment-224522889","issue_url":"https://api.github.com/repos/ExcelDataReader/ExcelDataReader/issues/122","id":224522889,"user":{"login":"Ian1971","id":318793,"avatar_url":"https://avatars.githubusercontent.com/u/318793?v=3","gravatar_id":"","url":"https://api.github.com/users/Ian1971","html_url":"https://github.com/Ian1971","followers_url":"https://api.github.com/users/Ian1971/followers","following_url":"https://api.github.com/users/Ian1971/following{/other_user}","gists_url":"https://api.github.com/users/Ian1971/gists{/gist_id}","starred_url":"https://api.github.com/users/Ian1971/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ian1971/subscriptions","organizations_url":"https://api.github.com/users/Ian1971/orgs","repos_url":"https://api.github.com/users/Ian1971/repos","events_url":"https://api.github.com/users/Ian1971/events{/privacy}","received_events_url":"https://api.github.com/users/Ian1971/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T08:28:19Z","updated_at":"2016-06-08T08:28:19Z","body":"In what way is it not thread-safe to read from a dictionary? (other than enumeration)"}}
{"actor":{"display_login":"Ian1971"}}