{"action":"created","issue":{"url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/1027","repository_url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS","labels_url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/1027/labels{/name}","comments_url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/1027/comments","events_url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/1027/events","html_url":"https://github.com/ILIAS-eLearning/ILIAS/pull/1027","id":315782773,"node_id":"MDExOlB1bGxSZXF1ZXN0MTgyNzA2MTcy","number":1027,"title":"Fix race condition concerning saved to question in autosave.","user":{"login":"lieblb","id":25431384,"node_id":"MDQ6VXNlcjI1NDMxMzg0","avatar_url":"https://avatars0.githubusercontent.com/u/25431384?v=4","gravatar_id":"","url":"https://api.github.com/users/lieblb","html_url":"https://github.com/lieblb","followers_url":"https://api.github.com/users/lieblb/followers","following_url":"https://api.github.com/users/lieblb/following{/other_user}","gists_url":"https://api.github.com/users/lieblb/gists{/gist_id}","starred_url":"https://api.github.com/users/lieblb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lieblb/subscriptions","organizations_url":"https://api.github.com/users/lieblb/orgs","repos_url":"https://api.github.com/users/lieblb/repos","events_url":"https://api.github.com/users/lieblb/events{/privacy}","received_events_url":"https://api.github.com/users/lieblb/received_events","type":"User","site_admin":false},"labels":[{"id":175960415,"node_id":"MDU6TGFiZWwxNzU5NjA0MTU=","url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/labels/bugfix","name":"bugfix","color":"fc2929","default":false}],"state":"closed","locked":false,"assignee":{"login":"bheyser","id":2587908,"node_id":"MDQ6VXNlcjI1ODc5MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2587908?v=4","gravatar_id":"","url":"https://api.github.com/users/bheyser","html_url":"https://github.com/bheyser","followers_url":"https://api.github.com/users/bheyser/followers","following_url":"https://api.github.com/users/bheyser/following{/other_user}","gists_url":"https://api.github.com/users/bheyser/gists{/gist_id}","starred_url":"https://api.github.com/users/bheyser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bheyser/subscriptions","organizations_url":"https://api.github.com/users/bheyser/orgs","repos_url":"https://api.github.com/users/bheyser/repos","events_url":"https://api.github.com/users/bheyser/events{/privacy}","received_events_url":"https://api.github.com/users/bheyser/received_events","type":"User","site_admin":false},"assignees":[{"login":"bheyser","id":2587908,"node_id":"MDQ6VXNlcjI1ODc5MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2587908?v=4","gravatar_id":"","url":"https://api.github.com/users/bheyser","html_url":"https://github.com/bheyser","followers_url":"https://api.github.com/users/bheyser/followers","following_url":"https://api.github.com/users/bheyser/following{/other_user}","gists_url":"https://api.github.com/users/bheyser/gists{/gist_id}","starred_url":"https://api.github.com/users/bheyser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bheyser/subscriptions","organizations_url":"https://api.github.com/users/bheyser/orgs","repos_url":"https://api.github.com/users/bheyser/repos","events_url":"https://api.github.com/users/bheyser/events{/privacy}","received_events_url":"https://api.github.com/users/bheyser/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-04-19T08:49:59Z","updated_at":"2018-08-09T12:16:28Z","closed_at":"2018-08-09T12:16:28Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/pulls/1027","html_url":"https://github.com/ILIAS-eLearning/ILIAS/pull/1027","diff_url":"https://github.com/ILIAS-eLearning/ILIAS/pull/1027.diff","patch_url":"https://github.com/ILIAS-eLearning/ILIAS/pull/1027.patch"},"body":"Diesen Fehler haben wir schon im alten ILIAS EA in der Wildbahn gehabt. Scheint mit dem SEB/Firefox eher nicht aufzutreten, mit Google Chrome aber sehr wohl.\r\n\r\nUrsache ist, dass beim Autospeichern zum Zeitpunkt der Installation des Timers eine URL hart kodiert wird, in der die Fragen-Sequence-Id `sequence` steht, z.B. wie hier:\r\n\r\n```\r\n\"autosaveUrl\":\"ilias.php?ref_id=73&sequence=3&active_id=102&pmode=edit&cmd=autosave&cmdClass=iltestplayerfixedquestionsetgui&cmdNode=rz:mt:yn&baseClass=ilrepositorygui&cmdMode=asynch\"\r\n```\r\n\r\nMit dieser URL wird nun in `ilTestPlayerQuestionEditControl.js` via `setInterval` ein timer installiert, der irgendwann auf diese URL feuert:\r\n\r\n```\r\n$.ajax({\r\n    type: 'POST',\r\n    url: url, // falsche URL\r\n    data: newData,\r\n    dataType: 'text',\r\n    timeout: config.autosaveInterval\r\n})\r\n```\r\n\r\nIst zum Zeitpunkt des Feuerns bereits eine andere Frage aufgerufen worden, wird die URL der alten Frage mit den POST-Daten der neuen Frage aufgerufen; dies führt zu einem Überschreiben einer Frage A mit den Ergebnissen aus Frage B.\r\n\r\nDer Kern des Problems ist, dass Funktionen wie `getCurrentQuestionId()` die aktuelle Frage aus `$_GET` und nicht aus `$_POST` holen, und damit Ergebnisse auf falsche Fragen gesichert werden können:\r\n\r\n```\r\nprotected function getCurrentQuestionId()\r\n{\r\n    return $this->testSequence->getQuestionForSequence($_GET[\"sequence\"]);\r\n}\r\n```\r\n\r\nDieser PR prüft daher, zumindest für Autospeichern, ab, dass kein Mismatch vorhanden ist."},"comment":{"url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/comments/411737103","html_url":"https://github.com/ILIAS-eLearning/ILIAS/pull/1027#issuecomment-411737103","issue_url":"https://api.github.com/repos/ILIAS-eLearning/ILIAS/issues/1027","id":411737103,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMTczNzEwMw==","user":{"login":"lieblb","id":25431384,"node_id":"MDQ6VXNlcjI1NDMxMzg0","avatar_url":"https://avatars0.githubusercontent.com/u/25431384?v=4","gravatar_id":"","url":"https://api.github.com/users/lieblb","html_url":"https://github.com/lieblb","followers_url":"https://api.github.com/users/lieblb/followers","following_url":"https://api.github.com/users/lieblb/following{/other_user}","gists_url":"https://api.github.com/users/lieblb/gists{/gist_id}","starred_url":"https://api.github.com/users/lieblb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lieblb/subscriptions","organizations_url":"https://api.github.com/users/lieblb/orgs","repos_url":"https://api.github.com/users/lieblb/repos","events_url":"https://api.github.com/users/lieblb/events{/privacy}","received_events_url":"https://api.github.com/users/lieblb/received_events","type":"User","site_admin":false},"created_at":"2018-08-09T12:16:28Z","updated_at":"2018-08-09T12:16:28Z","author_association":"CONTRIBUTOR","body":"@bheyser Ich sehe jetzt in TestILIAS unter bestimmten Rahmenbedingungen einen sehr ähnlichen Effekt. Details unter https://www.ilias.de/mantis/view.php?id=23410.\r\n\r\nKurz gesagt:\r\n\r\n(1) Der vorliegende PR greift zu kurz.\r\n(2) Ich glaube, dass eine erzwungene Serialisierung des POSTs alle derartigen Effekte löst.\r\n\r\nZu (2): man verzichtet für den Autospeichern-Modus komplett auf das klassische POST, und sendet stattdessen nur noch POSTs über JavaScript, das aber nur, wenn bereits aller vorhergehenden POST-Requests (auch die des Autospeicherns), erfolgreich vom Server zurückgekehrt sind (d.h. \"Weiter\" wartet dann asynchron, bis das Autospeichern fertig ist).\r\n\r\nIch bin sicher, dass das die Wurzel des Effekts (ein Absenden des regulären POST-Requests, während noch ein unbeantworteter Autosave-Ajax-Request rumhängt) behebt.\r\n\r\nIch schließe diesen PR, da die konkrete vorgeschlagene Lösung nicht gut ist.\r\n"}}
{"actor":{"display_login":"lieblb"}}