[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c12 Jeffrey Stedfast changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution||FIXED --- Comment #12 from Jeffrey Stedfast 2011-08-16 14:37:09 UTC --- Okay, this should be fixed now. I've added an (internal, for now) ABAddressBook property to ABRecord and fixed all places in the AddressBook and AddressBookUI namespaces to properly set it. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c11 --- Comment #11 from Jonathan Pryor 2011-08-02 21:04:03 UTC --- Based on the code and description, it does appear to be a "premature" collection, as ABPerson doesn't contain a reference to ABAddressBook, so the GC won't know that the ABPerson reference depends upon the ABAddressBook instance. A good way to test to see if this is the case would be to change AddressBook.cs CollectContacts() to do: var addressBook = new ABAddressBook(); var person = addressBook.GetPeople()[0]; // better have at least one person... addressBook.Dispose(); _allContacts.Add (new Contact { FirstName = person.FirstName }); As for how to fix this, I'm not sure. We could add an ABRecord.AddressBook property to keep the ABAddressBook alive, but we'd need to take care to set this property within ABAddressBook.GetPeople() and any other method that creates a new ABRecord subclass. This would also be adding a member that doesn't exist in the underlying API; I'm not sure if this would be desirable. On a related note, the ABAddressBookCreate() docs explicitly state: http://developer.apple.com/library/ios/#documentation/AddressBook/Reference/ABAddressBookRef_iPhoneOS/Reference/reference.html#//apple_ref/doc/uid/TP40007099 "Important: You must ensure that an instance of ABAddressBookRef is used by only one thread." If the GC is run on a different thread, this could be bad. :-) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c Miguel de Icaza changed: What|Removed |Added Status|NEEDINFO|REOPENED InfoProvider|andrewdyo...@gmail.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c10 Miguel de Icaza changed: What|Removed |Added CC||jonpr...@vt.edu, ||mig...@xamarin.com AssignedTo|fr...@novell.com|j...@xamarin.com --- Comment #10 from Miguel de Icaza 2011-08-01 15:58:03 UTC --- Adding Jonathan to provide some feedback. Perhaps we need to keep a reference to the object in these ABPersons. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c9 --- Comment #9 from Sebastien Pouliot 2011-07-21 21:22:31 UTC --- Got to read more code but my guess is that the 'people' array (well the objects inside it) depends on the addressBook being alive. Once 'addressBook' is freed their handles are not valid anymore - and that can lead to crashes. I'm pretty sure this would happen under Debug too... eventually. I cannot get it to crash when adding a second C.WL, seems being a bit slower at execution is affecting the crash likeliness (no clue how this could relate to the GC). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c8 --- Comment #8 from Andrew Young 2011-07-21 21:10:51 UTC --- Another question would be why this doesn't happen when running in Debug mode? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c7 --- Comment #7 from Andrew Young 2011-07-21 21:08:55 UTC --- So far I haven't been able to get it to crash. It seems like a GC issue. Not sure why disposing of the addressBook at the end of the loop (or rather ensuring that it doesn't get collected during the loop) would cause it to not crash. It shouldn't be getting collected within the loop anyway. For now it is pretty stable. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c6 Sebastien Pouliot changed: What|Removed |Added Status|NEW |NEEDINFO InfoProvider||andrewdyo...@gmail.com --- Comment #6 from Sebastien Pouliot 2011-07-21 21:02:55 UTC --- depends on what you mean by "much more stable" ? if it's like "less often" then simply adding C.WL made it even harder to crash for me (another change could make it easier) if it's like "no crash anymore" then it could be a GC issue, the using would ensure 'addressBook' does not get collected until looping has ended. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c5 --- Comment #5 from Andrew Young 2011-07-21 20:55:36 UTC --- Alright. So I tried putting a using around the ABAddressBook object and it seems to be much more stable. using(var addressBook = new ABAddressBook()) { ... } Any reason why this would be the case? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c4 --- Comment #4 from Sebastien Pouliot 2011-07-21 20:50:52 UTC --- The device logs also show the managed stack (before the native one seen in the orginal comment). You can get them by doing: /Developer/MonoTouch/usr/bin/mtouch --logdev inside a terminal. Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : Stacktrace: Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at MonoTouch.AddressBook.ABRecord.CopyValue (int) <0x00027> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at MonoTouch.AddressBook.ABPerson.GetPhones () <0x00023> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at AbCrash.AddressBook.CollectContacts () <0x000db> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at AbCrash.AppDelegate.m__0 (object,System.EventArgs) <0x0007b> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at MonoTouch.UIKit.UIControlEventProxy.Activated () <0x00043> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0x> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000cf> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at MonoTouch.UIKit.UIApplication.Main (string[]) <0x00023> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at AbCrash.Application.Main (string[]) <0x0001b> Jul 21 16:20:46 unknown UIKitApplication:abcrash[0xc778][6294] : at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0x> However the issue likely happens before that GetPhones call. E.g. adding a C.WL bfore the call to check how many items/people are inside the array cause an NRE (the value stays the same until the crash). // populate dictionary with contacts in address book var addressBook = new ABAddressBook(); var people = addressBook.GetPeople(); Console.WriteLine (people.Length); // <-- this will NRE after a while foreach(var person in people) { var phones = person.GetPhones(); foreach(var phone in phones) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c3 --- Comment #3 from Andrew Young 2011-07-21 20:44:01 UTC --- I'm on an iPhone iOS 4.3.3. If that makes any difference. But good to see that you got the error now. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c2 Sebastien Pouliot changed: What|Removed |Added Status|NEEDINFO|NEW InfoProvider|andrewdyo...@gmail.com | --- Comment #2 from Sebastien Pouliot 2011-07-21 20:18:39 UTC --- Ok, I eventually got it. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs
[Mono-bugs] [Bug 707114] crash when collecting all persons from ABAddressBook
https://bugzilla.novell.com/show_bug.cgi?id=707114 https://bugzilla.novell.com/show_bug.cgi?id=707114#c1 Sebastien Pouliot changed: What|Removed |Added Status|NEW |NEEDINFO CC||sebastien.poul...@gmail.com InfoProvider||andrewdyo...@gmail.com --- Comment #1 from Sebastien Pouliot 2011-07-21 19:43:54 UTC --- How many times (approximatively) are required ? I did not crash on my iPad (tried more than 100 times, release builds) but I do not have many contacts / phone numbers. Can you provide more details (hardware, #contacts...) so we try to duplicate the issue in similar conditions. p.s. Please open future bug reports on bugzilla.xamarin.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the QA contact for the bug. ___ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs