{"id":13,"date":"2006-04-28T12:02:59","date_gmt":"2006-04-28T10:02:59","guid":{"rendered":"http:\/\/soci.hu\/blog\/?p=13"},"modified":"2006-04-28T12:02:59","modified_gmt":"2006-04-28T10:02:59","slug":"deadlock-detektalas-net-appokban","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2006\/04\/28\/deadlock-detektalas-net-appokban\/","title":{"rendered":"Deadlock detekt\u00e1l\u00e1s .NET Appokban"},"content":{"rendered":"<p>Java konzolban a CTRL-Backspace kilist\u00e1zza a sz\u00e1lak \u00e1llapot\u00e1t, azt is, ha n\u00e9melyik \u00e1ll deadlock miatt, \u00e9s ilyenkor az is l\u00e1tszik, hogy melyik szinkroniz\u00e1ci\u00f3s primit\u00edveken \u00e1lltak meg a sz\u00e1lak. (Nem l\u00e1ttam m\u00e9g, mondt\u00e1k.)<\/p>\n<p>J\u00f3 lenne ilyen .NET-ben is, de alapban nincs. De megoldhat\u00f3. A 2.0-s fw-ben alaposan kib\u0151v\u00edtett\u00e9k a CLR hosting interf\u00e9szt, \u00edgy a CLR-t explicit bet\u00f6lt\u0151 nem menedzselt processzek sok mindenben bele tudnak sz\u00f3lni a CLR \u00e9let\u00e9be. Az eg\u00e9sz az SQL Server 2005 CLR t\u00e1mogat\u00e1s miatt ker\u00fclt be a .NET-be, de most ne politiz\u00e1ljunk.<\/p>\n<p>P\u00e9ld\u00e1ul amikor egy Monitor.Lock k\u00e9nytelen Windows szinkroniz\u00e1ci\u00f3s primit\u00edvet haszn\u00e1lni, mert t\u00e9nyleg t\u00f6bb sz\u00e1l akar bejutni a kritikus szekci\u00f3ba, akkor a CLR kisz\u00f3lhat a hosthoz, hogy adj\u00e1l m\u00e1r nekem egy Eventet (ez nem a .NET event, ez egy Windows szinkroniz\u00e1ci\u00f3s primit\u00edv). Ekkor a host feljegyezheti melyik sz\u00e1l milyen lockot k\u00e9rt, \u00edgy k\u00fcl\u00f6n sz\u00e1lon \u00e9szre tudja venni, ha k\u00f6rk\u00f6r\u00f6s v\u00e1rakoz\u00e1sok alakulnak ki, azaz deadlock van a programban. Okos, nem?<\/p>\n<p>Az eg\u00e9sz egy k\u00e9sz, haszn\u00e1lhat\u00f3 kis programmal egy\u00fctt ki van dolgozva egy <a href=\"http:\/\/msdn.microsoft.com\/msdnmag\/issues\/06\/04\/Deadlocks\/default.aspx\" target=\"_blank\">msdn magazin cikkben<\/a>. Csak el kell ind\u00edtani a detekt\u00e1l\u00f3 programot, param\u00e9terk\u00e9nt \u00e1tadva a megfigyelend\u0151 programot, \u00e9s sz\u00e9pen ki\u00edrja, amikor deadlockot tal\u00e1l, a program pedig meg\u00e9l egy deadlockr\u00f3l t\u00e1j\u00e9koztat\u00f3 exceptiont. \u00dcgyes, de t\u00e9nyleg.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java konzolban a CTRL-Backspace kilist\u00e1zza a sz\u00e1lak \u00e1llapot\u00e1t, azt is, ha n\u00e9melyik \u00e1ll deadlock miatt, \u00e9s ilyenkor az is l\u00e1tszik, hogy melyik&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-net","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}