Crash related to ui_tooltip
Closed, ResolvedPublic

Description

System Information
Operating system
Linux

Blender Version
Broken: 72a23e6564019636b797ad61ecce59e29199c9b5
default settings.

Short description of error
I've seen this several times after clicking on some of the left buttons in the view:

Segmentation fault in ui_tooltip_data_append_from_keymap
at source/blender/editors/interface/interface_region_tooltip.c:333

gdb back trace

Thread 1 "blender8tip" received signal SIGSEGV, Segmentation fault.
0x00005555568299b3 in ui_tooltip_data_append_from_keymap (keymap=<optimized out>, data=0x7fffac500b08, C=0x7fffce46d408)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:333
333					field->text = BLI_strdup(ot->description[0] ? ot->description : ot->name);
(gdb) bt
#0  0x00005555568299b3 in ui_tooltip_data_append_from_keymap (keymap=<optimized out>, data=0x7fffac500b08, C=0x7fffce46d408)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:333
#1  0x00005555568299b3 in ui_tooltip_data_from_tool (C=C@entry=0x7fffce46d408, but=but@entry=0x7fffae390508, is_label=is_label@entry=false)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:592
#2  0x000055555682a678 in UI_tooltip_create_from_button (C=0x7fffce46d408, butregion=0x7fffcbc7e388, but=0x7fffae390508, is_label=<optimized out>)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:1241
#3  0x0000555556658ff4 in WM_tooltip_init (C=C@entry=0x7fffce46d408, win=0x7fffcc3f9b88) at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_tooltip.c:123
#4  0x00005555566590ee in WM_tooltip_immediate_init (C=C@entry=0x7fffce46d408, win=<optimized out>, ar=ar@entry=0x7fffcbc7e388, init=init@entry=0x5555567fe910 <ui_but_tooltip_init>)
    at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_tooltip.c:60
#5  0x00005555568019fd in button_activate_init (C=C@entry=0x7fffce46d408, ar=ar@entry=0x7fffcbc7e388, but=but@entry=0x7fffae390508, type=type@entry=BUTTON_ACTIVATE_OVER)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_handlers.c:7476
#6  0x000055555680773c in ui_handle_button_over (C=0x7fffce46d408, event=0x7fffae69a788, ar=0x7fffcbc7e388)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_handlers.c:7824
#7  0x00005555568081fe in ui_region_handler (C=0x7fffce46d408, event=0x7fffae69a788, UNUSED_userdata=<optimized out>)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_handlers.c:9682
#8  0x000055555663d3db in wm_handler_ui_call (always_pass=0, event=0x7fffae69a788, handler=0x7fffcbe3bf88, C=0x7fffce46d408)
    at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_event_system.c:569
#9  0x000055555663d3db in wm_handlers_do_intern (C=C@entry=0x7fffce46d408, event=event@entry=0x7fffae69a788, handlers=handlers@entry=0x7fffcbc7e4d8)
    at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_event_system.c:2386
#10 0x000055555663de9c in wm_handlers_do (C=C@entry=0x7fffce46d408, event=event@entry=0x7fffae69a788, handlers=handlers@entry=0x7fffcbc7e4d8)
    at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_event_system.c:2619
#11 0x000055555663e802 in wm_event_do_handlers (C=C@entry=0x7fffce46d408) at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_event_system.c:3073
#12 0x0000555556635e40 in WM_main (C=0x7fffce46d408) at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm.c:412
#13 0x00005555565f3d3a in main (argc=1, argv=0x7fffffffdd18) at /intranet/blender-build/blender-git/source/creator/creator.c:525
(gdb) l
328					        data, &(uiTooltipFormat){
329					            .style = UI_TIP_STYLE_NORMAL,
330					            .color_id = UI_TIP_LC_MAIN,
331					            .is_pad = true,
332					        });
333					field->text = BLI_strdup(ot->description[0] ? ot->description : ot->name);
334				}
335				/* Shortcut */
336				{
337					uiTooltipField *field = text_field_add(
(gdb) bt full
#0  0x00005555568299b3 in ui_tooltip_data_append_from_keymap (keymap=<optimized out>, data=0x7fffac500b08, C=0x7fffce46d408)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:333
        ot = 0x7fffcc2c5aa8
        kmi = 0x7fffb00787c8
        fields_len_init = <optimized out>
        buf = "3\000_ui.space_toolsystem_common.description_from_name(bpy.context, bpy.context.space_data.type, 'Transform') + '.'\000\325\377\377\377\177\000\000\071~ɵ\377\177\000\000\030!\325\313\377\177\000\000`e\230\313\377\177\000\000\300\000\000\000\000\000\000\000YF\rWUU\000\000\000\000\000\000\000\000\000\000\267\367\331VUU\000\000\000 \027\314\377\177\000\000YF\rWUU\000\000\377\377\377\377\000\000\000\000\267"...
        keymap = <optimized out>
        expr_imports = {0x5555587d7adb "bpy", 0x5555587d7adf "bl_ui", 0x0}
        expr = "getattr(bl_ui.space_toolsystem_common.keymap_from_name(bpy.context, bpy.context.space_data.type, 'Transform'), 'as_pointer', lambda: 0)()\000\235\307\004\273\353O\000`\025D\000\200\022B\001\001r(", '\000' <repeats 21 times>, " \027\314\377\177\000\000\000\000\000\000\000\000\000\000\340\307\025\254\377\177\000\000"...
        expr_result = 140736150252904
        tool_name = "Transform\000\235\307\004\273\353O\342'\202=KK\347:@\330\377\377\377\177\000\000\000\331\377\377\377\177\000\000\260:\350YUU\000\000\000\000\000\000\000\000\000\000\300:\350YUU\000"
        data = 0x7fffac500b08
#1  0x00005555568299b3 in ui_tooltip_data_from_tool (C=C@entry=0x7fffce46d408, but=but@entry=0x7fffae390508, is_label=is_label@entry=false)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:592
        keymap = <optimized out>
        expr_imports = {0x5555587d7adb "bpy", 0x5555587d7adf "bl_ui", 0x0}
        expr = "getattr(bl_ui.space_toolsystem_common.keymap_from_name(bpy.context, bpy.context.space_data.type, 'Transform'), 'as_pointer', lambda: 0)()\000\235\307\004\273\353O\000`\025D\000\200\022B\001\001r(", '\000' <repeats 21 times>, " \027\314\377\177\000\000\000\000\000\000\000\000\000\000\340\307\025\254\377\177\000\000"...
        expr_result = 140736150252904
        tool_name = "Transform\000\235\307\004\273\353O\342'\202=KK\347:@\330\377\377\377\177\000\000\000\331\377\377\377\177\000\000\260:\350YUU\000\000\000\000\000\000\000\000\000\000\300:\350YUU\000"
        data = 0x7fffac500b08
#2  0x000055555682a678 in UI_tooltip_create_from_button (C=0x7fffce46d408, butregion=0x7fffcbc7e388, but=0x7fffae390508, is_label=<optimized out>)
    at /intranet/blender-build/blender-git/source/blender/editors/interface/interface_region_tooltip.c:1241
        win = 0x7fffcc3f9b88
        init_position = {-26199824, 4.59163468e-41}
        data = 0x0
        is_no_overlap = <optimized out>
        init_rect = {xmin = -1404456312, xmax = 32767, ymin = 1451204828, ymax = 21845}
#3  0x0000555556658ff4 in WM_tooltip_init (C=C@entry=0x7fffce46d408, win=0x7fffcc3f9b88) at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_tooltip.c:123
        screen = 0x7fffcc3c4288
        pass_prev = 0
        pass_delay = 0
#4  0x00005555566590ee in WM_tooltip_immediate_init (C=C@entry=0x7fffce46d408, win=<optimized out>, ar=ar@entry=0x7fffcbc7e388, init=init@entry=0x5555567fe910 <ui_but_tooltip_init>)
    at /intranet/blender-build/blender-git/source/blender/windowmanager/intern/wm_tooltip.c:60
---Type <return> to continue, or q <return> to quit---q

Details

Type
Bug

Unfortunately I don't know any pattern to reproduce.
Happens here randomly 2-3x / day during a quick work on low-poly game assets.

E.g. right now on the current blender2.8 branch tip:

# Blender 2.80 (sub 30), Commit date: 2018-11-06 12:08, Hash 9d32b9fb8a7
bpy.ops.object.editmode_toggle()  # Operator
...
bpy.data.screens["Layout"].shading.type = 'MATERIAL'  # Property

# backtrace
blender8tip(BLI_system_backtrace+0x33) [0x5563f485b4c3]
blender8tip(+0x10e33f0) [0x5563f3dbc3f0]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f79c1206f20]
blender8tip(+0x12d7873) [0x5563f3fb0873]
blender8tip(UI_tooltip_create_from_button+0x68) [0x5563f3fb1538]
blender8tip(WM_tooltip_init+0x84) [0x5563f3de0044]
blender8tip(+0x12afa4d) [0x5563f3f88a4d]
blender8tip(+0x12b578c) [0x5563f3f8e78c]
blender8tip(+0x12b624e) [0x5563f3f8f24e]
blender8tip(+0x10eb3cb) [0x5563f3dc43cb]
blender8tip(+0x10ebe8c) [0x5563f3dc4e8c]
blender8tip(wm_event_do_handlers+0x5e2) [0x5563f3dc57f2]
blender8tip(WM_main+0x20) [0x5563f3dbce30]
blender8tip(main+0x35a) [0x5563f3d7ad2a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f79c11e9b97]
blender8tip(_start+0x2a) [0x5563f3db8b2a]

(For useful backtraces I have to run blender in the gdb)

Note that the backtrace for the crash isn't that useful in this case.

Before crashing there should be an error printed in the terminal which is the cause of the problem.

We can make it so it checks for errors and gives a warning instead of crashing,
but I'd like to find the root cause since making tooltips shouldn't be unreliable.


Edit 1: for release builds errors generating the tips shouldn't assert or crash. So not sure why this is crashing.

Edit 2: The tooltip now shows an error if it can't be generated, however it seems likely this isn't the same problem thats reported here - rB0bd61227c246a488bd06b76fba213c44448379c7

field->text = BLI_strdup(ot->description[0] ? ot->description : ot->name);

I'm not familiar with the code, but it looks like some timing/concurrency problem.

Before crashing there should be an error printed in the terminal which is the cause of the problem.

The only output I get

Writing: /tmp/blender.crash.txt
Segmentation fault

with the same bt:

cat /tmp/blender.crash.txt
# Blender 2.80 (sub 30), Commit date: 2018-11-07 10:31, Hash f1fc5ba5375

# backtrace
blender8tip(BLI_system_backtrace+0x33) [0x55e31a922cb3]
blender8tip(+0x10e32c0) [0x55e319e812c0]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7eff61470f20]
blender8tip(+0x12d7b4a) [0x55e31a075b4a]
blender8tip(UI_tooltip_create_from_button+0x68) [0x55e31a076798]
blender8tip(WM_tooltip_init+0x84) [0x55e319ea5144]
blender8tip(wm_event_do_handlers+0x775) [0x55e319e8a855]
blender8tip(WM_main+0x20) [0x55e319e81d00]
blender8tip(main+0x35a) [0x55e319e3fbfa]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7eff61453b97]
blender8tip(_start+0x2a) [0x55e319e7d9fa]
Philipp Oeser (lichtwerk) closed this task as Resolved.Fri, Nov 9, 4:41 PM

as @Martin Capitanio (capnm) says, rB3d0383d25932 also fixes this report, lets close this then.