Umbraco Intermittent database exceptions during database operations - umbraco

I am using Umbraco version 7.4.3 assembly: 1.0.5948.18141
I am getting intermittent exceptions during fetch and query operations. I have scoured the web for answers and am coming up empty. This is what shows up in my umbraco log file when I get these errors. I have validated that with the same query that works over and over again, that occasionally I get this error. I have added retry logic with garbage collection in the exception handlers and sleep statements, but to no avail. Anything anyone could suggest to shed light on this would be extremely helpful. I am desperate. :)
2016-11-03 10:49:12,240 [P2872/D6/T1120] ERROR
Umbraco.Core.Persistence.UmbracoDatabase - Database exception occurred
System.NullReferenceException: Object reference not set to an instance
of an object. at Umbraco.Core.Persistence.Database.d71.MoveNext()
2016-11-03 10:49:13,442 [P2872/D6/T1120] ERROR
Umbraco.Core.Persistence.UmbracoDatabase - Database exception occurred
System.NullReferenceException: Object reference not set to an instance
of an object. at
Umbraco.Core.Persistence.Database.d__71.MoveNext() 2016-11-03
10:49:14,518 [P2872/D6/T1120] ERROR
Umbraco.Core.Persistence.UmbracoDatabase - Database exception occurred
System.NullReferenceException: Object reference not set to an instance
of an object. at Umbraco.Core.Persistence.Database.d7`1.MoveNext()

Related

Core Data: Illegal attempt to establish a relationship 'statusmedia' between objects in different contexts

I am using Core Data on my app. After a light weight migration and code upgradation to swift 4.0, I am facing few issues.
Issue 1
Mutating a managed object 0x7fd0881de320 (0x7fd0884589b0) after it has been removed from its context.
Issue 2
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Illegal attempt to establish a relationship 'statusmedia' between objects in different contexts (source = (entity: Status; id: 0x10f6dc280
Termination issue is very serious.
Note that I have used only one Context (default one and not private)
Let me know if you want more information from me...
Any help would be greatly appreciated.
Many may happen unfortunately to lead to this but top candidates to check would be:
In your model there are delete rules on relations. A "cascade" option should delete the object(s) in relation when deleting this object. If this is not expected such an error could easily be produced.
You are deleting an object but then still use it. It is a logical bug but can be easily confirmed by marking deleted managed objects (put the IDs of deleted objects into some array) and then checking if the failed object is marked (it's ID exists in that array).
You are using multiple contexts but not aware of it. Some tools like fetch result controllers are potential candidates.
There are still other possibilities but I would start with these mentioned to begin with.

terminating with uncaught exception of type realm::LogicError: Data type mismatch

Suddenly my app started to crash when trying to save something on Realm. I couldn't specifically trace where this error was occurring. Error message:
terminating with uncaught exception of type realm::LogicError: Data type mismatch
Any thoughts?
Turns out this issue is caused when you try to save a realm object, or assign it to another realm object, while it still doesn't have its Primary Key (or any other required key) set.
Explaining better, if you create a realm object and forget to set its Primary Key, when you try to perform a save action (via addOrUpdateObject or commitWriteTransaction, or any other saving method), or even when you try to relate that object to another realm object (e.g. chat.message = message, while message doesn't have a PK yet), that exception might be thrown.
To fix this, ensure that every realm object you're creating has its PK and required keys set before saving it.

CoreData compare Error during Save

I'm having some issues with saving a new object/editing an existing one, from a One-To-Many relationship in CoreData.
I have a class Patient that has a To-Many relationship with class Indication.
What's been happening is:
First time I create an Indication Object from a normal workflow, it all seems to save alright, but if I try to access it from an Edit screen, it crashes with a SIGABRT and the following error
-[Patient compare:]: unrecognized selector sent to instance 0x7fa991893ca0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Patient compare:]: unrecognized selector sent to instance 0x7fa991893ca0'
The same happens if I try to create a new one from the NSFetchedResultsController that shows the list of Indication Objects.
I've tried to create the relationships between them in two ways:
indication = [NSEntityDescription insertNewObjectForEntityForName:#"Indication"
inManagedObjectContext:appDelegate.managedObjectContext];
indication.patient = patient;
and through the GeneratedAccessors from CoreData:
[patient addIndicationObject:indication];
and I validate both objects during viewDidLoad to avoid creating a new Indication if I'm editing an existing one. But in both cases I get the same error.
Haven't been able to find any posts related to this matter so far. Please help.
After a few days researching this with no success, finally I've managed to find a post that managed to shine some light on the problem.
It happens that the NSFetchedResultsControllerDelegate seems to "lock" the NSManagedObjectContext and that's why I couldn't add or change anything within the same context.
I just had to set the delegate to nil once I left the screen and everything seems to work just fine now.
Thanks for the solution on this post:
Core data: Serious application error

Getting error while binding view with a model

Every property is present in the model. But still getting error:
An exception of type 'System.NullReferenceException' occurred in App_Web_vzy5d524.dll but was not handled in user code
I am not getting why this error is occuring. Things were working fine not started getting error.
Please guide if any idea.
It indicates that your model value is NULL

Strange CoreData error ... value returned from insertNewObjectForEntityForName: appears to be corrupt

I have a very strange error happening in an App that has been working for a long time.
I can no longer create one of my entities in my CoreData model.
When I create one particular entity in my model and try to print it using NSLog( #"%#", obj ), I get this strange message:
2011-11-08 13:03:05.936 iLearnFast[31541:15503] -[__NSCFNumber objectID]: unrecognized selector sent to instance 0xa069e20
When I loop over the attributes / relationships for this object and print them out, one particular one to one relationship returns a strange value from [obj valueForKey:]. The value it returns is the same pointer / object that is mentioned in the above error message.
I thought I might have been corrupting memory somewhere, but I inserted the code to create the entity at the very beginning of my executable as soon as datastructures are initialized, and I get the same problem. I am extremely confident that I have not made any memory errors at this point (and a memory error would be more random ... I can create thousands of objects, and always the same entity has the same problem with the same relationship, and no other entities ever have a problem).
After narrowing down the problem to this one relationship, I found that I could make the error go away by renaming the relationship to anything else. The relationship has been called "file" since my App was created.
I can make my code work again by renaming the property, although it messes up my automatic lightweight migration, but now I have to deal with figuring out how to do a more complicated migration.
If anyone has any ideas as to what might be going wrong, I would really appreciate it.
This is baffling me, and really feels like a bug in Apple's SDK.
I'm currently using XCode 4.2 and tried both the SDKs for both iOS5.0 and iOS4.3 and both had the same behaviour.
Ron
2011-11-08 13:03:05.936 iLearnFast[31541:15503] -[__NSCFNumber
objectID]: unrecognized selector sent to instance 0xa069e20
I guess you have a leak in your code. This line means that you trying to access objectID property which contains in your custom NSManagedObject, but for some reason that object no longer lives. Try to check your code on memory leaks.
I saw this same issue arise in a Swift project using Core Data. The issue only raised it's head when I pushed the app onto a device (it had been working fine in the simulator for some time).
The issue centred around a relationship between two entities. To illustrate see problem image:
After looking around SO for sometime I decided to rename the relationships, captain and player. See fix image:
Only after renaming both 'ends' of the relationship did the error go away.
I had same error message and in my case reason was that I had relation property teacher and created read-only property isTeacher.
This issue caused by Objective-C name conventions: CoreData was confused in getting teacher property. Instead of accessing real relation and giving me real object it taking isTeacher getter with BOOL type, cast it to NSNumber and try to deal with it like CoreData relation and call objectID.
After renaming isTeacher to isTeacherLicence problem gone.

Resources