New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About XMPPRosterStorage mainThreadManagedObjectContext will let app die question #340
Comments
Have you init your modules using the main queue rather than another queue e.g. High Priority Queue? |
This seems to be a duplicate of issue #336.
Though I don't quite know the fix, I've isolated the failure point to be in XMPPCoreDataStorage. Calls to get the context call down to the PersistentStore coordinator getter. Inside the getter, at the very bottom, last if/else. On first run of the app, I generally hit the if block and get a valid context back (the if condition executes block()). On pretty much every other attempt to access the context, I hit the else condition which tries to call dispatch_sync(storageQueue, block); at this point the call just hangs. I haven't seen it actually crash but that's because it hangs so badly on this call that I generally just have to kill the simulator -- have not yet tried it on the phone. I have read and re-read the CoreData notes on the project Wiki and I am reasonably certain I am not running afoul of any of its cautions. That said, I have no idea what I did, but in my initial implementation I had it actually working but since then (yesterday afternoon) I'm getting this behavior. Have even refactored my code to pretty much follow the iPhoneXMPP example line but line and still see this behavior. I'm on the point of just removing the core data backing altogether, which would be a shame as it seems to be an excellent capability to be able to use and I don't relish having to write all the roster storage stuff myself. I know this is an Open Source project but a little more info/documentation on the various ways to use some of the storage mechanisms and/or how to write your own provider would be much welcome. Aside from that, it's a lovely framework and I look forward to using it on my current project. |
A possibly related issue (I can create a new issue if need be). Even though I am targeting SDK 7.0 and using ARC -- I keep hitting this conditional in GCDMulticastDelegate - > initWithDelegate: #if !OS_OBJECT_USE_OBJC I am hitting the dispatch_retain call - which I believe is invalid in ARC -- and crashing there. In fairness, I am using CocoaPods to manage XMPPFramework as a dependency. |
In regards to the NSFetchedResultController issues, if anyone wants to provide a sample of it locking up il be happy to take a look at it. |
I'll see if I can put together a reproducible sample later today or first thing tomorrow. |
Here's an example of how I'm using it. Of course, its all working fine here - except for using privates queues as noted above -- that repros or I am doing it wrong (probably the latter). The actual project we're using this in has its own Core Data stack - so it seems as though something is blocking CoreData retrieving the PSC when getting the main context as noted in my first comment above. |
Hi. you can try it. before start the project. please set the iPhone Simulator -> restore content and setting. look the console. please notice the output log. when all connect is done. the app will halt!!! most of time the first run the app will show these status. if you click my friends cell when some data not close connect . it can enter the my friends page. thanks a lot! |
@leolicai It seems to block on _xmppRoster = [[XMPPRoster alloc] initWithRosterStorage:_xmppRosterStorage dispatchQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)]; Do you see the same thing? |
@ObjColumnist Thanks man! |
I don't think its should break if you specify |
@ObjColumnist Use dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) it works ok.But, |
I don't know how your XMPPManger works but I'm guessing rosterStorage is nil |
I faced the same issue when using a subclassed |
Which bit in particular? this issue had a couple of tangents 😄 |
@ObjColumnist I wasn't sure myself. But I found something weird. I am using this framework for persistent room storage; more like WhatsApp. I basically join the room every time the user opens the app and download the required amount of history. There is a small (big?) issue with the above approach. The
but fails for:
Thats one of the things I was talking about — if it could affect the program in different ways. I consider this to be a small issue as I have a small work around — basically check my core data if the room exists; add if it does not (similar to what I do in |
I'm guessing it's a race condition coupled with fact the XMPPRoom doesn't check its current state, so that delegate could be fired an infinite amount of times. I haven't used MUC so I couldn't comment on if this is expected or a bug. |
Hi, Every body!
There is a very bad problem. if our custom view controller use XMPPRosterStorage mainThreadManagedObjectContext to UIFetchResultsController auto refresh our friends list in a table view. then if xmppStream have received a iq:roster message.
The app will die.
I think the have dispatch_sync() call two times use one queue flag.
Anybody have the solution? I ask use xmppframework friend.
nobody can fix it!
Thanks
The text was updated successfully, but these errors were encountered: