DJI SDK iOS crash - ios

DJI SDK iOS community
I have been connecting the M300 and this crash has happening me randomly, any idea how to mitigate this issue?
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000bbf6e3070
Crashed: Thread
0 libobjc.A.dylib 0x1cf4 objc_msgSend + 20
1 DJISDK 0xa3e920 GetIsFCConnectedHandle(unsigned long long) + 51100
2 DJISDK 0x204288 mop_link_layer_recv + 128
3 DJISDK 0x204f1c mop_link_layer_node_init + 2908
4 libsystem_pthread.dylib 0x3348 _pthread_start + 116
5 libsystem_pthread.dylib 0x1948 thread_start + 8

Your problem is most likely caused by incorrect initialisation in conjunction with a network related event, say an inbound data packet.
Inbound data handling often use the words "recv" in their name.
Your third party code is trying to message an object at a too low an address (but not around zero). This usually means that some base pointer is nil, but some other value has been added to it, and that is the address being used.
Notice that your code is called from GetISFCConnectedHandle, and it takes a likely pointer-like argument. This is often a tell tale of code which has pointers to handler objects stored in data structures.
The first thing is to check configuration and initialisation data structures for your SDK and its associated hardware. The next thing to do is to enable the different sanitisers (address sanitiser for example) or use the memory allocations instrument to see the history of the system up until the crash. Then you'll have context as to what is going on.
The official resource for sanitisers is
https://developer.apple.com/documentation/xcode/diagnosing-memory-thread-and-crash-issues-early
I also have a book which goes over similar ground and gives some tips. Good luck!

Related

SOC1 Abend in Cobol program

I have a SOC1 abend when executing mt cobol program. Any ideas?
I get these messages in the JESMSGLG
10.18.45 JOB07120 IGD17296I DYNAMIC VOLUME COUNT (DVC=5) WAS USED TO 433
433 EXTEND DATA SET VALSD.ALT.CACD602.RF0020RC.LONENSEL.#C
10.18.48 JOB07120 IGD17296I DYNAMIC VOLUME COUNT (DVC=5) WAS USED TO 467
467 EXTEND DATA SET VALSD.ALT.CACD602.RF0020RC.LONENSEL.#C
10.18.51 JOB07120 IGD17296I DYNAMIC VOLUME COUNT (DVC=5) WAS USED TO 544
544 EXTEND DATA SET VALSD.ALT.CACD602.RF0020RC.LONENSEL.#C
10.18.54 JOB07120 IGD17296I DYNAMIC VOLUME COUNT (DVC=5) WAS USED TO 597
597 EXTEND DATA SET VALSD.ALT.CACD602.RF0020RC.LONENSEL.#C
10.18.59 JOB07120 IEC028I 837-08,IFG0554A,OCACD602,COLST51P,LONENSEL,6355,TSOD05, 688
688 VALSD.ALT.CACD602.RF0020RC.LONENSEL.#C
EDIT: When I use less input (= less output) I don't get the abend.
I can't see from the image, but like the guys before stated, disk space appears to be your problem. Try to allocate a small size on the primary allocation, and more on secondary. My recollection of this problem is that the primary allocation needs one chunk of space of specified size, but secondary allocations are split. This becomes more important when disc space is limited. Try running an idcams listcat to check for space. Then if necessary include a vol=ser parameter into your JCL. It might also be a good idea to include some file status checking into Cobol program. This makes issues like this far easier to resolve.

Crash in free()

I have several crash reports from an iOS app that stem from a SIGABRT in a free() call.
The call stack is consistent:
0 libsystem_kernel.dylib 0x3863c1f0 __pthread_kill + 8
1 libsystem_c.dylib 0x385ecfdd abort + 77
2 libsystem_malloc.dylib 0x38664d67 free + 383
I'm trying to get more diagnostics, but in the meantime, did anyone encounter the same? What kind of a wrong argument would crash a free() call? I can see several options:
a null pointer (actually legit)
a data area pointer (i. e. a string literal)
a stack pointer
a garbage pointer (i. e. an uninitialized one)
a heap pointer that was already freed
Any ideas please? Those are pretty rare, the last one was in Sep
'14. But I've got over 10 total, there is probably a bug there.
If I read the stack dump correctly, the code triggered an assertion in free and called abort. Look at the source code for the libsystem_malloc on http://opensource.apple.com and try and figure which assertion failed.
You have a stray pointer, guessing where it is hiding from a single non reproducible crash is next to impossible. Running your application in the emulator with valgrind (if that's possible) may help you track memory misuse.
It the stack dump is longer that 3 lines, you should have an indication of which call to free caused the problem. It may help you track the bug, but it may also be a late side-effect of some earlier pointer misuse.

ios and opencv: how to correctly call cvtColor without wasting memory?

I am using this function here in my ios app:
cv::cvtColor(image, image, cv::COLOR_BGR2RGB);
But when I call this in my - (void)processImage:(cv::Mat&)image delegate method,
images get lost in memory. So after a few seconds my app crashes with memory problems.
Terminated due to Memory Pressure
Don't I just copy the converted image over the previous image?
And what can I do to prevent this behavior?
- (void)processImage:(cv::Mat&)image
{
cv::cvtColor(image, image, cv::COLOR_BGR2RGB);
}
Some output of how data looks like in inspector (these vm_allocate lines appear a lot):
0 0x20961000 VM: CoreAnimation 00:22.762.010 • 7,91 MB QuartzCore CA::Render::aligned_malloc(unsigned long, void**)
1 0x20178000 VM: CoreAnimation 00:22.415.490 • 7,91 MB QuartzCore CA::Render::aligned_malloc(unsigned long, void**)
2 0x2114a000 CGSImageData 00:22.762.165 • 5,95 MB CoreGraphics CGSImageDataHandleCreate
3 0x1f3a0000 VM: Foundation 00:22.752.743 • 5,93 MB libsystem_kernel.dylib vm_allocate
4 0x1fb89000 VM: Foundation 00:22.408.091 • 5,93 MB libsystem_kernel.dylib vm_allocate
I usually convert over the original image with no problem. You can create another destination mat image if you wish to preserve the original one. So it's based on case to case basis.
Would rather comment than reply, but my answer would be too long.
Try this methods:
1) High chance is due to you not declaring the channel. For instance CV_8U3, etc..
2) If step one doesn't work, the other high possibility: Try using CV_BGR2RGB instead of cv::COLOR_BGR2RGB (Version compatibility problem)
3) Have you tried removing the pointer? &
If the three methods still doesn't work, please do comment on the exact error message you are receiving on this answer. I will try help you out. Cheers.
EDIT(To answer your comments):
When I was talking about channels, I meant CV_8U3, CV_8U, etc. You don't have to try it anymore though, cause the error is due to the IOS's aggressive kernel thread which sets all to kill all the processes on low memory. This means when background process are running, they are more likely to be "killed" to allocate memory for the current/running/foreground process.
More information about that kernel:http://newosxbook.com/articles/MemoryPressure.html
I am not an expertise when it comes to IOS, but things I think you can try:
1)Use global Variable, for instance, make Mat Image global rather than local
2)A slightly bad programming convention to some: skip the function and just dump the code from the function to the main/or program which was trying to call the function. This ensures that the IOS doesn't need to switch process, hence killing either of them.
3) Define app profile(UIBackgroundMode) in kernel, thereby taming Jetsam, the aggressive kernel killer a little.
4) release images from RAM (remove the reference to them) when there is no more need to the images

Does 'malloc_error_break' occurs on the same thread as the underlying memory corruption

I am trying to debug an occasional crash in our iOS application.
We get 'malloc_error_break' with the usual 'object was modified after being freed'.
The crash occurs in the same C library, but at different malloc places.
The top of the backtrace looks like this:
* thread #29: tid = 0x3a03, 0x32c8cfa8 libsystem_c.dylib`malloc_error_break, stop reason = breakpoint 1.1
frame #0: 0x32c8cfa8 libsystem_c.dylib`malloc_error_break
frame #1: 0x32c71ed0 libsystem_c.dylib`szone_error + 220
frame #2: 0x32c71f1c libsystem_c.dylib`free_list_checksum_botch + 28
frame #3: 0x32c1d3bc libsystem_c.dylib`tiny_malloc_from_free_list + 348
frame #4: 0x32c1c44a libsystem_c.dylib`szone_malloc_should_clear + 1274
frame #5: 0x32c1bf1e libsystem_c.dylib`malloc_zone_malloc + 66
Question:
Does this guarantee that the underlying memory corruption (f.i. double free, etc) happens on the same thread as the 'malloc_zone_malloc'? Or at least that the memory malloc_error_break is referring to, was allocated on the same thread?
Knowing this for sure, would help me isolate the crash from influence of other libraries, NSURLConnection requests, etc. The app is quite big and difficult too debug, as it is.
Edit:
I guess what I wanted too know first was something simpler.
Do different threads have separate heaps / malloc lists in iOS?
malloc_error_break() is invoked as soon as memory corruption is discovered, no matter what thread happens to discover it. There are absolutely no guarantees as to which thread this will be.
Do different threads have separate heaps / malloc lists in iOS?
No. There is a single shared heap used by all threads in your process.

Ground-truth data collection and evaluation for computer vision

Currently I am starting to develop a computer vision application that involves tracking of humans. I want to build ground-truth metadata for videos that will be recorded in this project. The metadata will probably need to be hand labeled and will mainly consist of location of the humans in the image. I would like to use the metadata to evaluate the performance of my algorithms.
I could of course build a labeling tool using, e.g. qt and/or opencv, but I was wondering if perhaps there was some kind of defacto standard for this. I came across Viper but it seems dead and it doesn't quite work as easy as I would have hoped. Other than that, I haven't found much.
Does anybody here have some recommendations as to which software / standard / method to use both for the labeling as well as the evaluation? My main preference is to go for something c++ oriented, but this is not a hard constraint.
Kind regards and thanks in advance!
Tom
I've had another look at vatic and got it to work. It is an online video annotation tool meant for crowd sourcing via a commercial service and it runs on Linux. However, there is also an offline mode. In this mode the service used for the exploitation of this software is not required and the software runs stand alone.
The installation is quite elaborately described in the enclosed README file. It involves, amongst others, setting up an appache and a mysql server, some python packages, ffmpeg. It is not that difficult if you follow the README. (I mentioned that I had some issues with my proxy but this was not related to this software package).
You can try the online demo. The default output is like this:
0 302 113 319 183 0 1 0 0 "person"
0 300 112 318 182 1 1 0 1 "person"
0 298 111 318 182 2 1 0 1 "person"
0 296 110 318 181 3 1 0 1 "person"
0 294 110 318 181 4 1 0 1 "person"
0 292 109 318 180 5 1 0 1 "person"
0 290 108 318 180 6 1 0 1 "person"
0 288 108 318 179 7 1 0 1 "person"
0 286 107 317 179 8 1 0 1 "person"
0 284 106 317 178 9 1 0 1 "person"
Each line contains 10+ columns, separated by spaces. The
definition of these columns are:
1 Track ID. All rows with the same ID belong to the same path.
2 xmin. The top left x-coordinate of the bounding box.
3 ymin. The top left y-coordinate of the bounding box.
4 xmax. The bottom right x-coordinate of the bounding box.
5 ymax. The bottom right y-coordinate of the bounding box.
6 frame. The frame that this annotation represents.
7 lost. If 1, the annotation is outside of the view screen.
8 occluded. If 1, the annotation is occluded.
9 generated. If 1, the annotation was automatically interpolated.
10 label. The label for this annotation, enclosed in quotation marks.
11+ attributes. Each column after this is an attribute.
But can also provide output in xml, json, pickle, labelme and pascal voc
So, all in all, this does quite what I wanted and it is also rather easy to use.
I am still interested in other options though!
LabelMe is another open annotation tool. I think it is less suitable for my particular case but still worth mentioning. It seems to be oriented at blob labeling.
This is a problem that all practitioners of computer vision face. If you're serious about it, there's a company that does it for you by crowd-sourcing. I don't know whether I should put a link to it in this site, though.
I've had the same problem looking for a tool to use for image annotation to build a ground truth data set for training models for image analysis.
LabelMe is a solid option if you need polygonal outlining for your annotation. I've worked with it before and it does the job well and has some additional cool features when it comes to 3d feature extraction. In addition to LabelMe, I also made an open source tool called LabelD. If you're still looking for a tool to do your annotation, check it out!

Resources