stephanecharette / DarkMark

Marking up images for use with Darknet.
https://www.ccoderun.ca/darkmark/Summary.html
Other
160 stars 21 forks source link

"Segmentation fault" when DMContentImportTxt::run() called #3

Closed vledoze closed 3 years ago

vledoze commented 3 years ago

Hi,

I tried the last version of DarkMark, and i ran into "Segmentation Fault" when I tried to create json files from txt file for my data. I quickfixed it with disabling the calls to resized() and rebuild_image_and_repaint() functions inside content.load_image(idx) when called from DMContentImportTxt::run(), but I think there might be a better solution.

Regards, Vincent

stephanecharette commented 3 years ago

Is it a specific image/annotations that caused the problem? When you run DarkMark from the command line, it should log things to console. If you can determine which image/txt file causes the problem and I can replicate it, then I can fix the issue.

vledoze commented 3 years ago

I don't think that is because of a specific image or .txt annotation because DarkMark can always create the json files for the "n" first images with missing json file, then crash on the "n+1" image. When I restart, it starts creating the json files starting at the previous "n+1" image, then crash at "n+m" image.

For information the logs are

2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 00:29:07 backtrace #0: DarkMark(+0xb4cff) [0x55eae26f7cff]
2021-03-24 00:29:07 backtrace #1: DarkMark(+0xb6072) [0x55eae26f9072]
2021-03-24 00:29:07 backtrace #2: /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fa049103210]
2021-03-24 00:29:07 backtrace #3: /lib/x86_64-linux-gnu/libopencv_imgproc.so.4.2(+0x27113c) [0x7fa049c1d13c]
2021-03-24 00:29:07 backtrace #4: /lib/x86_64-linux-gnu/libopencv_core.so.4.2(+0x2110e8) [0x7fa04980d0e8]
2021-03-24 00:29:07 backtrace #5: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c545) [0x7fa036557545]
2021-03-24 00:29:07 backtrace #6: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c80f) [0x7fa03655780f]
2021-03-24 00:29:07 backtrace #7: /lib/x86_64-linux-gnu/libtbb.so.2(+0x25bd7) [0x7fa036550bd7]
2021-03-24 00:29:07 backtrace #8: /lib/x86_64-linux-gnu/libtbb.so.2(+0x24498) [0x7fa03654f498]
2021-03-24 00:29:07 backtrace #9: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20880) [0x7fa03654b880]
2021-03-24 00:29:07 backtrace #10: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20a8d) [0x7fa03654ba8d]
2021-03-24 00:29:07 backtrace #11: /lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7fa04a038609]
2021-03-24 00:29:07 backtrace #12: /lib/x86_64-linux-gnu/libc.so.6: clone +0x43 [0x7fa0491df293]
2021-03-24 00:29:07 backtrace #0: DarkMark(+0xb4cff) [0x55eae26f7cff]
2021-03-24 00:29:07 backtrace #1: DarkMark(+0xb6072) [0x55eae26f9072]
Aborted (core dumped)
stephanecharette commented 3 years ago

The lines before the stack trace is what I was hoping to see. That stack trace you posted is from a non-debug build, which is why it isn't very useful. But the lines before will hopefully give more insight into why this is happening. I have about 2 dozen DarkMark projects, and the segmentation fault does not happen with any of them, so I'm thinking there must be something special about one of your images, or the annotations for that image.

stephanecharette commented 3 years ago

I think I got it to reproduce. Seeing if I can figure out what is going on.

vledoze commented 3 years ago

I can't reproduce the issue with a debug build.

vledoze commented 3 years ago

With the previous lines

2021-03-24 10:47:26 starting a new image set at index=0, fn=(..)/data/categories/batch_1/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=101, fn=(..)/data/categories/batch_10/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=201, fn=(..)/data/categories/batch_11/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=301, fn=(..)/data/categories/batch_12/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=401, fn=(..)/data/categories/batch_13/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=501, fn=(..)/data/categories/batch_14/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=601, fn=(..)/data/categories/batch_15/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=686, fn=(..)/data/categories/batch_2/000000.JPG
2021-03-24 10:47:26 starting a new image set at index=778, fn=(..)/data/categories/batch_3/IMG_4852.JPG
2021-03-24 10:47:26 starting a new image set at index=875, fn=(..)/data/categories/batch_4/000000.JPG
2021-03-24 10:47:26 starting a new image set at index=964, fn=(..)/data/categories/batch_5/000000.JPG
2021-03-24 10:47:26 starting a new image set at index=1076, fn=(..)/data/categories/batch_6/000000.JPG
2021-03-24 10:47:26 starting a new image set at index=1173, fn=(..)/data/categories/batch_7/000000.JPG
2021-03-24 10:47:26 starting a new image set at index=1300, fn=(..)/data/categories/batch_8/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=1400, fn=(..)/data/categories/batch_9/000000.jpg
2021-03-24 10:47:26 starting a new image set at index=1500, fn=(..)/data/categories/unofficial/000000.jpg
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 10:47:33 backtrace #0: DarkMark(+0xb4cef) [0x55b596a8bcef]
2021-03-24 10:47:33 backtrace #1: DarkMark(+0xb6062) [0x55b596a8d062]
2021-03-24 10:47:33 backtrace #2: /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f4984f77210]
2021-03-24 10:47:33 backtrace #3: /lib/x86_64-linux-gnu/libopencv_imgproc.so.4.2(+0x27113c) [0x7f4985a9113c]
2021-03-24 10:47:33 backtrace #4: /lib/x86_64-linux-gnu/libopencv_core.so.4.2(+0x2110e8) [0x7f49856810e8]
2021-03-24 10:47:33 backtrace #5: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c545) [0x7f49723cb545]
2021-03-24 10:47:33 backtrace #6: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c80f) [0x7f49723cb80f]
2021-03-24 10:47:33 backtrace #7: /lib/x86_64-linux-gnu/libtbb.so.2(+0x25bd7) [0x7f49723c4bd7]
2021-03-24 10:47:33 backtrace #8: /lib/x86_64-linux-gnu/libtbb.so.2(+0x24498) [0x7f49723c3498]
2021-03-24 10:47:33 backtrace #9: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20880) [0x7f49723bf880]
2021-03-24 10:47:33 backtrace #10: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20a8d) [0x7f49723bfa8d]
2021-03-24 10:47:33 backtrace #11: /lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7f4985eac609]
2021-03-24 10:47:33 backtrace #12: /lib/x86_64-linux-gnu/libc.so.6: clone +0x43 [0x7f4985053293]
Aborted (core dumped)
stephanecharette commented 3 years ago

Please try the latest version I just pushed. I only managed to reproduce the crash a few times, so I'm not 100% this is the full fix.

vledoze commented 3 years ago

I just tried, i still have the issue

2021-03-24 15:33:20 ScrollField: rebuild cache image
2021-03-24 15:33:20 ScrollField: scale and redrawing image
2021-03-24 15:33:23 importing annotations for (..)/data/super_categories/batch_11/000022.jpg
2021-03-24 15:33:23 importing annotations for (..)/data/super_categories/batch_11/000023.jpg
2021-03-24 15:33:23 ScrollField: rebuild cache image
2021-03-24 15:33:23 ScrollField: scale and redrawing image
2021-03-24 15:33:23 importing annotations for (..)/data/super_categories/batch_11/000024.jpg
2021-03-24 15:33:23 ScrollField: rebuild cache image
2021-03-24 15:33:23 ScrollField: scale and redrawing image
2021-03-24 15:33:23 importing annotations for (..)/data/super_categories/batch_11/000025.jpg
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 aborting due to signal: "Segmentation fault" [signal #11]
2021-03-24 15:33:23 backtrace #0: DarkMark(+0xb4fff) [0x564bdd5b0fff]
2021-03-24 15:33:23 backtrace #1: DarkMark(+0xb6372) [0x564bdd5b2372]
2021-03-24 15:33:23 backtrace #2: /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f35ae5d7210]
2021-03-24 15:33:23 backtrace #3: /lib/x86_64-linux-gnu/libopencv_imgproc.so.4.2(+0x27113c) [0x7f35af0f113c]
2021-03-24 15:33:23 backtrace #4: /lib/x86_64-linux-gnu/libopencv_core.so.4.2(+0x2110e8) [0x7f35aece10e8]
2021-03-24 15:33:23 backtrace #5: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c545) [0x7f359ba2b545]
2021-03-24 15:33:23 backtrace #6: /lib/x86_64-linux-gnu/libtbb.so.2(+0x2c80f) [0x7f359ba2b80f]
2021-03-24 15:33:23 backtrace #7: /lib/x86_64-linux-gnu/libtbb.so.2(+0x25bd7) [0x7f359ba24bd7]
2021-03-24 15:33:23 backtrace #8: /lib/x86_64-linux-gnu/libtbb.so.2(+0x24498) [0x7f359ba23498]
2021-03-24 15:33:23 backtrace #9: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20880) [0x7f359ba1f880]
2021-03-24 15:33:23 backtrace #10: /lib/x86_64-linux-gnu/libtbb.so.2(+0x20a8d) [0x7f359ba1fa8d]
2021-03-24 15:33:23 backtrace #11: /lib/x86_64-linux-gnu/libpthread.so.0(+0x9609) [0x7f35af50c609]
2021-03-24 15:33:23 backtrace #12: /lib/x86_64-linux-gnu/libc.so.6: clone +0x43 [0x7f35ae6b3293]
Aborted (core dumped)
stephanecharette commented 3 years ago

I'm having a hard time reproducing this issue as it seems to be timing related and doesn't happen in debug mode. In release mode I have gotten it to trigger a few times, but very rare and difficult to debug in release mode. I believe it is an interaction between the scrollfield thread and other threads. I'm putting together a fix that will temporarily disable the scrollfield thread and other temporary threads, such as those created when rotating images or importing the .txt annotations.

stephanecharette commented 3 years ago

Please try v1.4.3-1 or later and see if the problem still happens the same way.

vledoze commented 3 years ago

Hi, I'm sorry I still have this issue with the latest version.

stephanecharette commented 3 years ago

Any chance you can zip up the project and data set and send it to me privately for me to debug?

stephanecharette commented 3 years ago

No update in 3 months. Closing. Please re-open if this is still an issue and you can provide some test files.