{"issue":{"milestone":null,"title":"Improper use of lock and unlock and racing condition in tablenested","created_at":"2012-01-01T13:25:31Z","user":{"id":1293692,"login":"marcel-kanter","url":"https://api.github.com/users/marcel-kanter","gravatar_id":"ef3dd527aad52800060401ee15301c81","avatar_url":"https://secure.gravatar.com/avatar/ef3dd527aad52800060401ee15301c81?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"updated_at":"2012-01-01T17:33:52Z","labels":[],"state":"open","id":2697150,"html_url":"https://github.com/joomla/joomla-platform/issues/691","closed_at":null,"pull_request":{"patch_url":"https://github.com/joomla/joomla-platform/pull/691.patch","html_url":"https://github.com/joomla/joomla-platform/pull/691","diff_url":"https://github.com/joomla/joomla-platform/pull/691.diff"},"body":"This is a change according to trackers:\r\nhttp://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=27569\r\nhttp://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=27562\r\n\r\nReason for the changes are the work of LOCK TABLES SQL statement. it works differnt then intented by the php code here. Lock has no \"Incremental\" behaviour instead it is \"Release-If-Any and Set-New\". So in tablenested the tables got unlocked after modifing the assets\r\n\r\nImplemented for SQL Server too (was missing).\r\n\r\nThe lock has to be made in combination for the both tables. Is the same bebaviour on all databases. mysql here as an example: http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html is worth a reading.\r\n\r\nRules for Lock Release\r\n\r\nWhen the table locks held by a session are released, they are all released at\r\nthe same time. A session can release its locks explicitly, or locks may be\r\nreleased implicitly under certain conditions.\r\n\r\n  *  A session can release its locks explicitly with UNLOCK TABLES.\r\n\r\n  *  If a session issues a LOCK TABLES statement to acquire a lock while\r\nalready holding locks, its existing locks are released implicitly before the\r\nnew locks are granted.\r\n\r\n  *  If a session begins a transaction (for example, with START TRANSACTION), an\r\nimplicit UNLOCK TABLES is performed, which causes existing locks to be released.\r\n(For additional information about the interaction between table locking and\r\ntransactions, see Section 12.3.5.1, “Interaction of Table Locking and\r\nTransactions”.)\r\n\r\n\r\nSo a change in the lock/unlock functions are needed too.","number":691,"url":"https://api.github.com/repos/joomla/joomla-platform/issues/691","comments":5,"assignee":null},"comment":{"created_at":"2012-01-01T17:33:52Z","user":{"id":1293692,"login":"marcel-kanter","url":"https://api.github.com/users/marcel-kanter","gravatar_id":"ef3dd527aad52800060401ee15301c81","avatar_url":"https://secure.gravatar.com/avatar/ef3dd527aad52800060401ee15301c81?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"updated_at":"2012-01-01T17:33:52Z","id":3325122,"body":"@realityking For some reason in Joomla Exceptions and Errors are used to communicated normal things like the failure of functions. Exceptions are used to inform the caller about abnormal ( ;) ) events normally (an dead database is such a abnormal thing - but not the result of an query). Since SQL LOCK is a blocking query this would never fail.\r\n\r\n@chdemko This should not be in this pull request. I'm new to git and somehow this got into this request. I hope i can remove these changes from this pull request. The reason for the change anyway is that i'm working on a library which has some dependancies so i need to check it before installing. The other thing is that the other extension types have support for it too so why not the rest of them?","url":"https://api.github.com/repos/joomla/joomla-platform/issues/comments/3325122"},"action":"created"}