Simperium - Diff errors, UniCharMax - ios

I'm serializing an array of dictionaries to a string and it seems that it causes issues on the generation of the diff… or something… I've been seeing a lot of these:
AssertMacros: hash <= (~(UniChar)0x00), Hash value has exceeded UniCharMax! file: /Users/…/Pods/Google-Diff-Match-Patch/DiffMatchPatchCFUtilities.c, line: 391
I didn't look very deep but I didn't understood what am I doing wrong…
Also, I'm having a lot of 440 errors that sometimes appear with the error above. How can I handle these errors? Shouldn't the framework send the full object when the 440 pops up?
Thanks!

Error 440 means 'Invalid Diff'. After checking DiffMatchPatch, it seems that the error you're seeing is caused by an excesively large array of diffs (which, in this case, seems to be a Diff Match Patch internal issue).
Please, take a look at this pull request, which already implements the mechanism you're currently working on: https://github.com/Simperium/simperium-ios/pull/121
Specifically, NSArray+Simperium, SPMemberJsonList and SPJsonDiff contain logic to handle DiffMatchPatch.

Related

CommRenderer cannot cope with an absent value in commUser.getPosition()

The documentation of commUser.getPosition() advices to return Optional.absent() if no position can be determined. Yet, lines 170 in CommRenderer throws an exception if commUser.getPosition() is absent:
helper.fillCircle(user.getPosition().get(), DOT_RADIUS);
The method exampleCommunicationAgent.getPosition() returns absence, if RoadUser is not on roadmap - which happens sometimes, but I cannot pinpoint when exactly. It might have something to do with increasing the speed, but I can't reproduce it reliably.
This bug is fixed as of RinSim 4.4.5.

CFNetwork internal error: CFNetworkInternal.h:478

My iOS device logs (on simulator and real devices) was filled with a couple dozen lines of the following error spam:
CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork_Sim/CFNetwork-758.0.2/ProjectRuntime/CFNetworkInternal.h:478)
Why am I seeing these, and how do I get rid of them?
Turns out this was due to an incorrect setup in my Info.plist's NSAppTransportSecurity.
Make sure that for each of the NSExceptionDomains you use, the subfields of the dictionary (such as NSIncludesSubdomains, NSExceptionRequiresForwardSecrecy, and NSExceptionAllowsInsecureHTTPLoads) are set to type Boolean, not String. While XCode may display your values of YES and NO very similarly, the type is important for ensuring CFNetwork is able to understand your config without any errors.
Incorrect:
Correct:

Assertion failed: xdrPtr && xdrPtr == *xdrLPP, file xx.cpp, line 2349

Have a system build using C++ Builder 2010 that after running for about 20 hours it starts firing of assertion failures.
Assertion failed: xdrPtr && xdrPtr == *xdrLPP, file xx.cpp, line 2349
Tried google on it like crazy but not much info. Some people seem to refer a bunch of different assertions in xx.cpp to shortcomings in the exception handling in C++ Builder. But I haven't found anything referencing this particular line in the file.
We have integrated madExcept and it seems like somewhere along the way this catches an out of memory exception, but not sure if it's connected. No matter what an assertion triggering doesn't seem correct.
Edit:
I found an instance of a if-statement that as part of it's statement used a function that could throw an exception. I wonder if this could be the culprit somehow messing up the flow of the exception handling or something?
Consider
if(foo() == 0) {
...
}
wrapped in a try catch block.
If an exception is thrown from within foo() so that no int is returned here how will the if statement react? I'm thinking it still might try to finish executing that line and this performing the if check on the return of the function which will barf since no int was returned. Is this well defined or is this undefined behaviour?
Wouldn't
int fooStatus = foo();
if(fooStatus == 0) {
...
}
be better (or should I say safer)?
Edit 2:
I just managed to get the assertion on my dev machine (the application just standing idle) without any exception about memory popping up and the app only consuming around 100 mb. So they were probably not connected.
Will try to see if I can catch it again and see around where it barfs.
Edit 3:
Managed to catch it. First comes an assertion failure notice like explained. Then the debugger shows me this exception notification.
If I break it takes me here in the code
It actually highlights the first code line after
pConnection->Open();
But it seems I can change this to anything and that line is still highlighted. So my guess is that the error is in the code above it somehow. I have seen more reports about people getting this type of assertion failure when working with databases in RAD Studio... hmmmm.
Update:
I found a thread that recursively called it's own Execute function if it wasn't able to reach the DB server. I think this is at least part of the issue. This will just keep on trying and as more and more worker threads spawn and also keep trying it can only end in disaster.
If madExcept is hinting that you have an out of memory condition, the assert could fail if the pointers are NULL (i.e. the allocation failed). What are the values of xdrPtr and xdrLPP when the assert occurs? Can you trace back to where they are allocated?
I would start looking for memory leaks.

Twitter streaming api 140dev error

I am using 140dev Twitter Database Server (PHP) and I am continually getting this error in get_tweet.php. the error I'm getting from the php-error.log file in the Windows/Temp/ directory
PHP Notice: Undefined property: stdClass::$created_at in C:\inetpub\wwwroot\140dev\db\get_tweets.php on line 58
line 58 in get_tweets.php is:
$dateStamp = $this->oDB->telldate($tweet_object->created_at);
I'm not sure why I'm getting this error. There are tons of other instances where $tweet_object->created_at is being used, but I don't get error messages in the php-errors.log file.
Any help would be greatly appreciated!
Okay so I found out that the code I've inherited was not handling all the other messages that occur in the streaming api.
to fix the logged Notice I set an if check before the json processing code:
if(isset($tweet_object->created_at)){
//Do stuff
}
This resolved the Notice messages. It's annoying that I didn't think of a Null check earlier.
*Note: I did try using the property_exists() method in the if statement, but that still displayed the Notice message. Just in case anybody was interested.

Simperium Received an Invalid Change

I am developing integration with Simperium, the integration is complete and has been running on test machines for sometime, I am starting to get this error on one of the devices and it keeps repeating constantly any ideas?
MeetingPad[891:1103] Simperium error (ActionLinks82), received an invalid change for (a18852011efe4964a6fdeb1853c790f3)
2013-02-07 10:07:05:277 MeetingPad[891:1103] Simperium client ios-7f43b434754d882923e966df5d885755 received change (ActionLinks82) ios-4176925448fa8ae0a2f1d0937627aa6b: {
ccids = (
3f3b4550b23147d49e194038feea09a6
);
clientid = "ios-4176925448fa8ae0a2f1d0937627aa6b";
cv = 5112df4b37a401031dcc5be1;
ev = 2;
id = 9ca0b7ad04314ab9888d75691be784b5;
o = "-";
}
If this occured on a user account what would be the guidance?
One thing to check is that you're using the latest version of the code. The repository was recently open sourced on GitHub. There used to be a bug related to nil values that could cause an invalid diff to appear in your change stream, but it should be fixed now.
Assuming you're using the latest code though, does the error repeat continuously for the same "id" value, or are there different values?
Looking at the Simperium code where this error occurs, it's possible it could be displayed if you've deleted an object locally and remotely at around the same time. In your app, might ActionLinks fit that pattern, i.e. are you creating and deleting a lot of them across multiple clients?
If that is indeed the cause, then the error is innocuous and we should patch the code. Let me know what you discover.

Resources