{"action":"created","issue":{"url":"https://api.github.com/repos/colincoghill/oasisqe/issues/54","labels_url":"https://api.github.com/repos/colincoghill/oasisqe/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/colincoghill/oasisqe/issues/54/comments","events_url":"https://api.github.com/repos/colincoghill/oasisqe/issues/54/events","html_url":"https://github.com/colincoghill/oasisqe/issues/54","id":19949340,"number":54,"title":"Add ability to retry transactions","user":{"login":"jamesdoherty","id":943116,"avatar_url":"https://avatars.githubusercontent.com/u/943116?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesdoherty","html_url":"https://github.com/jamesdoherty","followers_url":"https://api.github.com/users/jamesdoherty/followers","following_url":"https://api.github.com/users/jamesdoherty/following{/other_user}","gists_url":"https://api.github.com/users/jamesdoherty/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesdoherty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesdoherty/subscriptions","organizations_url":"https://api.github.com/users/jamesdoherty/orgs","repos_url":"https://api.github.com/users/jamesdoherty/repos","events_url":"https://api.github.com/users/jamesdoherty/events{/privacy}","received_events_url":"https://api.github.com/users/jamesdoherty/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/colincoghill/oasisqe/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"colincoghill","id":3960086,"avatar_url":"https://avatars.githubusercontent.com/u/3960086?v=3","gravatar_id":"","url":"https://api.github.com/users/colincoghill","html_url":"https://github.com/colincoghill","followers_url":"https://api.github.com/users/colincoghill/followers","following_url":"https://api.github.com/users/colincoghill/following{/other_user}","gists_url":"https://api.github.com/users/colincoghill/gists{/gist_id}","starred_url":"https://api.github.com/users/colincoghill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colincoghill/subscriptions","organizations_url":"https://api.github.com/users/colincoghill/orgs","repos_url":"https://api.github.com/users/colincoghill/repos","events_url":"https://api.github.com/users/colincoghill/events{/privacy}","received_events_url":"https://api.github.com/users/colincoghill/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/colincoghill/oasisqe/milestones/4","html_url":"https://github.com/colincoghill/oasisqe/milestones/3.9.4","labels_url":"https://api.github.com/repos/colincoghill/oasisqe/milestones/4/labels","id":372424,"number":4,"title":"3.9.4","description":"Start to incorporate the functionality required to support OASIS HighSchool.\r\n\r\nMainly around question editor, branding, and layout of practice section.","creator":{"login":"colincoghill","id":3960086,"avatar_url":"https://avatars.githubusercontent.com/u/3960086?v=3","gravatar_id":"","url":"https://api.github.com/users/colincoghill","html_url":"https://github.com/colincoghill","followers_url":"https://api.github.com/users/colincoghill/followers","following_url":"https://api.github.com/users/colincoghill/following{/other_user}","gists_url":"https://api.github.com/users/colincoghill/gists{/gist_id}","starred_url":"https://api.github.com/users/colincoghill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colincoghill/subscriptions","organizations_url":"https://api.github.com/users/colincoghill/orgs","repos_url":"https://api.github.com/users/colincoghill/repos","events_url":"https://api.github.com/users/colincoghill/events{/privacy}","received_events_url":"https://api.github.com/users/colincoghill/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":4,"state":"open","created_at":"2013-07-08T00:10:54Z","updated_at":"2015-05-26T06:11:58Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2013-09-24T00:01:44Z","updated_at":"2015-06-05T21:11:21Z","closed_at":null,"body":"We are seeing exceptions from time to time that are related to transaction commit failure. This looks to be causing issues with certain database fields not being updated when we're expecting them to (eg, the submittime field on the userexams table). OASIS should attempt to retry transactions that fail.\r\n\r\nAn couple of example exceptions:\r\n\r\n    Exception on /assess/assessmentpage/3/224/1 [POST] Traceback (most recent call last):\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1504, in wsgi_app\r\n        response = self.full_dispatch_request()\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1264, in full_dispatch_request\r\n        rv = self.handle_user_exception(e)\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1262, in full_dispatch_request\r\n        rv = self.dispatch_request()\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1248, in dispatch_request\r\n        return self.view_functions[rule.endpoint](**req.view_args)\r\n    File \"/opt/oasisqe/3.9/src/oasis/__init__.py\", line 107, in call_fn\r\n        return func(*args, **kwargs)\r\n    File \"/opt/oasisqe/3.9/src/oasis/views_assess.py\", line 137, in assess_assessmentpage\r\n        Exams.set_user_status(user_id, exam_id, 2)\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/Exams.py\", line 167, in set_user_status\r\n        run_sql(\"\"\"UPDATE userexams SET status=%s WHERE exam=%s AND student=%s;\"\"\", (status, exam, student))\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/DB.py\", line 45, in run_sql\r\n        dbpool.commit(conn)\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/Pool.py\", line 103, in commit\r\n        dbc.commit()\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/Pool.py\", line 68, in commit\r\n        self.conn.commit()\r\n    TransactionRollbackError: could not serialize access due to read/write dependencies among transactions\r\n    DETAIL:  Reason code: Canceled on identification as a pivot, during commit attempt.\r\n    HINT:  The transaction might succeed if retried.\r\n\r\n\r\n    Exception on /practice/markquestion/19/1985068 [POST] Traceback (most recent call last):\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1504, in wsgi_app\r\n        response = self.full_dispatch_request()\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1264, in full_dispatch_request\r\n        rv = self.handle_user_exception(e)\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1262, in full_dispatch_request\r\n        rv = self.dispatch_request()\r\n    File \"/usr/lib/python2.7/dist-packages/flask/app.py\", line 1248, in dispatch_request\r\n        return self.view_functions[rule.endpoint](**req.view_args)\r\n    File \"/opt/oasisqe/3.9/src/oasis/__init__.py\", line 107, in call_fn\r\n        return func(*args, **kwargs)\r\n    File \"/opt/oasisqe/3.9/src/oasis/views_practice.py\", line 271, in practice_mark_question\r\n        marking = Practice.mark_q(user_id, topic_id, question_id, request)\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/Practice.py\", line 209, in mark_q\r\n        DB.set_q_status(q_id, 3)    # 3 = marked\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/DB.py\", line 160, in set_q_status\r\n        run_sql(\"UPDATE questions SET status=%s WHERE question=%s;\", (status, q_id))\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/DB.py\", line 44, in run_sql\r\n        res = conn.run_sql(sql, params, quiet=quiet)\r\n    File \"/opt/oasisqe/3.9/src/oasis/lib/Pool.py\", line 51, in run_sql\r\n        rec = cur.execute(sql, params)\r\n    TransactionRollbackError: could not serialize access due to concurrent update"},"comment":{"url":"https://api.github.com/repos/colincoghill/oasisqe/issues/comments/109442170","html_url":"https://github.com/colincoghill/oasisqe/issues/54#issuecomment-109442170","issue_url":"https://api.github.com/repos/colincoghill/oasisqe/issues/54","id":109442170,"user":{"login":"colincoghill","id":3960086,"avatar_url":"https://avatars.githubusercontent.com/u/3960086?v=3","gravatar_id":"","url":"https://api.github.com/users/colincoghill","html_url":"https://github.com/colincoghill","followers_url":"https://api.github.com/users/colincoghill/followers","following_url":"https://api.github.com/users/colincoghill/following{/other_user}","gists_url":"https://api.github.com/users/colincoghill/gists{/gist_id}","starred_url":"https://api.github.com/users/colincoghill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colincoghill/subscriptions","organizations_url":"https://api.github.com/users/colincoghill/orgs","repos_url":"https://api.github.com/users/colincoghill/repos","events_url":"https://api.github.com/users/colincoghill/events{/privacy}","received_events_url":"https://api.github.com/users/colincoghill/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T21:11:21Z","updated_at":"2015-06-05T21:11:21Z","body":"Looks pretty good so far, still trying to prove that it works better."}}