Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polybar segfaults (segfault at 10 ip 00007f71861f3570 sp 00007f714affc298 error 4 in libfontconfig.so.1.11.1[7f71861da000+23000]) #1435

Closed
artee666 opened this issue Sep 22, 2018 · 7 comments

Comments

@artee666
Copy link

artee666 commented Sep 22, 2018

Describe the issue

Was running ubuntu 18.04 and polybar was running with the same config fine. Today upgraded to ubuntu 18.10 and recompiled polybar and it segfaults.
Version of libfontconfig:
Version: 2.13.0-5ubuntu3

Expected behavior:

It should not segfault.

Actual behavior:

It segfaults.

To Reproduce

A minimal but complete config with which the problem occurs:
I guess it has to do something with fonts and version of libfontconfig:

font-0 = Hack:pixelsize=10:weight=bold;2
font-1 = Hack:pixelsize=32;2
font-2 = "Font Awesome:pixelsize=12;2"
font-3 = Unifont:size=9;2

List any other steps needed to reproduce the issue besides starting polybar with the config you posted above.

Polybar Log

polybar main
warn: No monitor specified, using "HDMI-1"
Segmentation fault (core dumped)

GDB:

Reading symbols from polybar...run done.
(gdb) run main
Starting program: /usr/local/bin/polybar main
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffefcee700 (LWP 17057)]
warn: No monitor specified, using "HDMI-1"
[New Thread 0x7fffeb4ed700 (LWP 17058)]
[New Thread 0x7fffeacec700 (LWP 17059)]
[New Thread 0x7fffea4eb700 (LWP 17060)]
[New Thread 0x7fffe9cea700 (LWP 17061)]
[Thread 0x7fffea4eb700 (LWP 17060) exited]
[New Thread 0x7fffe94e9700 (LWP 17062)]
[New Thread 0x7fffe8ce8700 (LWP 17063)]
[Thread 0x7fffe94e9700 (LWP 17062) exited]
[New Thread 0x7fffcffff700 (LWP 17064)]
[Thread 0x7fffcffff700 (LWP 17064) exited]
[New Thread 0x7fffcf7fe700 (LWP 17065)]
[Thread 0x7fffe8ce8700 (LWP 17063) exited]
[New Thread 0x7fffceffd700 (LWP 17066)]
[Thread 0x7fffcf7fe700 (LWP 17065) exited]
[New Thread 0x7fffce7fc700 (LWP 17067)]
[Thread 0x7fffceffd700 (LWP 17066) exited]
[New Thread 0x7fffcdffb700 (LWP 17068)]
[New Thread 0x7fffcd7fa700 (LWP 17069)]
[Thread 0x7fffcdffb700 (LWP 17068) exited]
[New Thread 0x7fffccff9700 (LWP 17070)]
[New Thread 0x7fffc3fff700 (LWP 17071)]
[Thread 0x7fffccff9700 (LWP 17070) exited]
[New Thread 0x7fffc37fe700 (LWP 17072)]
[New Thread 0x7fffc2ffd700 (LWP 17073)]
[Thread 0x7fffc37fe700 (LWP 17072) exited]
[New Thread 0x7fffc27fc700 (LWP 17074)]
[New Thread 0x7fffc1ffb700 (LWP 17075)]
[Thread 0x7fffc27fc700 (LWP 17074) exited]
[New Thread 0x7fffc17fa700 (LWP 17076)]
[New Thread 0x7fffc0ff9700 (LWP 17077)]
[Thread 0x7fffc17fa700 (LWP 17076) exited]
[New Thread 0x7fffaffff700 (LWP 17078)]
[Thread 0x7fffc0ff9700 (LWP 17077) exited]

Thread 23 "polybar" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffaffff700 (LWP 17078)]
0x00007ffff7e6c570 in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1


BT FULL:

#0  0x00007ffff7e6c570 in ?? () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
No symbol table info available.
#1  0x00007ffff7e5e87a in FcDefaultSubstitute () from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1
No symbol table info available.
#2  0x00005555559153a1 in polybar::v3_2_1::cairo::make_font (cairo=0x7fffb4004860, fontname=..., offset=2, dpi_x=96, dpi_y=96)
    at /home/rporizka/gitrepos/polybar/include/cairo/font.hpp:260
        fc_init = true
        fc_cleanup = std::unique_ptr<polybar::v3_2_1::scope_util::on_exit<>> = {get() = 0x7fffb40a9da0}
        pattern = 0x0
        result = 21845
        match = 0x7fffafffe3e0
#3  0x0000555555916f39 in polybar::v3_2_1::renderer::renderer (this=0x7fffb4000c80, conn=..., sig=..., conf=..., logger=..., bar=...)
    at /home/rporizka/gitrepos/polybar/src/components/renderer.cpp:159
        offset = 2
        pattern = "Hack:pixelsize=10:weight=bold"
        pos = 29
        font = std::shared_ptr<polybar::v3_2_1::cairo::font_fc> (empty) = {get() = 0x120780}
        f = "Hack:pixelsize=10:weight=bold;2"
        __for_range = std::vector of length 4, capacity 4 = {"Hack:pixelsize=10:weight=bold;2", "Hack:pixelsize=32;2", "Font Awesome:pixelsize=12;2", "Unifont:size=9;2"}
        __for_begin = "Hack:pixelsize=10:weight=bold;2"
        __for_end = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>
        dpi_x = 96
        dpi_y = 96
        fonts = std::vector of length 4, capacity 4 = {"Hack:pixelsize=10:weight=bold;2", "Hack:pixelsize=32;2", "Font Awesome:pixelsize=12;2", "Unifont:size=9;2"}
        mask = <optimized out>
        value_list = <optimized out>
        params = <optimized out>
        dpi_x = <optimized out>
        dpi_y = <optimized out>
        fonts = <optimized out>
        screen = <optimized out>
        f = <optimized out>
        __for_range = <optimized out>
        __for_begin = <optimized out>
        __for_end = <optimized out>
        offset = <optimized out>
        pattern = <optimized out>
        pos = <optimized out>
        font = <optimized out>
#4  0x0000555555923930 in std::make_unique<polybar::v3_2_1::renderer, polybar::v3_2_1::connection&, polybar::v3_2_1::signal_emitter&, polybar::v3_2_1::config const&, polybar::v3_2_1::logger const&, polybar::v3_2_1::bar_settings const&> (__args#0=..., __args#1=..., __args#2=..., __args#3=..., __args#4=...) at /usr/include/c++/8/bits/unique_ptr.h:831
No locals.
#5  0x000055555592073e in polybar::v3_2_1::factory_util::unique<polybar::v3_2_1::renderer, polybar::v3_2_1::connection&, polybar::v3_2_1::signal_emitter&, polybar::v3_2_1::config const&, polybar::v3_2_1::logger const&, polybar::v3_2_1::bar_settings const&> (deps#0=..., deps#1=..., deps#2=..., deps#3=..., deps#4=...)
    at /home/rporizka/gitrepos/polybar/include/utils/factory.hpp:30
No locals.
#6  0x000055555591566a in polybar::v3_2_1::renderer::make (bar=...) at /home/rporizka/gitrepos/polybar/src/components/renderer.cpp:28
No locals.
#7  0x00005555558a1b5b in polybar::v3_2_1::bar::on (this=0x555555b9d180) at /home/rporizka/gitrepos/polybar/src/components/bar.cpp:781
No locals.
#8  0x00005555558fe8b6 in polybar::v3_2_1::signal_receiver_interface::on<polybar::v3_2_1::signals::eventqueue::start> (this=0x555555b9d1c0, s=...)
    at /home/rporizka/gitrepos/polybar/include/events/signal_receiver.hpp:33
        event_sink = 0x555555b9d1c8
#9  0x00005555558fa26a in polybar::v3_2_1::signal_emitter::emit<polybar::v3_2_1::signals::eventqueue::start> (this=0x555555b62f80, sig=...)
    at /home/rporizka/gitrepos/polybar/include/events/signal_emitter.hpp:29
        item = @0x555555ba0900: {first = 3, second = 0x555555b9d1c0}
        __for_range = std::multimap with 1 element = {[3] = 0x555555b9d1c0}
        __for_begin = {first = 3, second = 0x555555b9d1c0}
        __for_end = {first = 1, second = 0x555555ba09d0}
#10 0x00005555558f261e in polybar::v3_2_1::controller::process_eventqueue (this=0x555555b9fe80) at /home/rporizka/gitrepos/polybar/src/components/controller.cpp:352
No locals.
#11 0x00005555558fd8e2 in std::__invoke_impl<void, void (polybar::v3_2_1::controller::*)(), polybar::v3_2_1::controller*> (
    __f=@0x555555bc50f0: (void (polybar::v3_2_1::controller::*)(polybar::v3_2_1::controller * const)) 0x5555558f2566 <polybar::v3_2_1::controller::process_eventqueue()>, 
    __t=@0x555555bc50e8: 0x555555b9fe80) at /usr/include/c++/8/bits/invoke.h:73
No locals.
#12 0x00005555558f9624 in std::__invoke<void (polybar::v3_2_1::controller::*)(), polybar::v3_2_1::controller*> (
    __fn=@0x555555bc50f0: (void (polybar::v3_2_1::controller::*)(polybar::v3_2_1::controller * const)) 0x5555558f2566 <polybar::v3_2_1::controller::process_eventqueue()>, 
    __args#0=@0x555555bc50e8: 0x555555b9fe80) at /usr/include/c++/8/bits/invoke.h:95
No locals.
#13 0x000055555590b4d7 in std::thread::_Invoker<std::tuple<void (polybar::v3_2_1::controller::*)(), polybar::v3_2_1::controller*> >::_M_invoke<0ul, 1ul> (this=0x555555bc50e8)
    at /usr/include/c++/8/thread:244
No locals.
#14 0x000055555590b47d in std::thread::_Invoker<std::tuple<void (polybar::v3_2_1::controller::*)(), polybar::v3_2_1::controller*> >::operator() (this=0x555555bc50e8)
    at /usr/include/c++/8/thread:253
No locals.
#15 0x000055555590b392 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (polybar::v3_2_1::controller::*)(), polybar::v3_2_1::controller*> > >::_M_run (
    this=0x555555bc50e0) at /usr/include/c++/8/thread:196
No locals.
#16 0x00007ffff6d5c63f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
No symbol table info available.
#17 0x00007ffff6adf164 in start_thread (arg=<optimized out>) at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140736146175744, -3017355919341517241, 140737488339998, 140737488339999, 0, 140736146172736, 3017250366937499207, 
                3017376139834951239}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#18 0x00007ffff6a05def in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
No locals.

Environment:

  • WM:
    bspwm 0.9.5
  • Output of polybar -vvv:
    polybar 3.2.1

Features: -alsa +curl -i3 +mpd +network +pulseaudio +xkeyboard

X extensions: +randr (+monitors) -render -damage -sync -composite +xkb +xrm +xcursor

Build type: Debug
Compiler: /usr/bin/c++
Compiler flags: -Wall -Wextra -Werror -Wno-noexcept-type -O2 -pedantic -pedantic-errors
Linker flags:

@patrick96
Copy link
Member

Could you try to remove the pixelsize propery from your fonts? We had some issues where, if pixelsize was set, the bar wouldn't display any characters, maybe this is related as well.

@patrick96 patrick96 added the font label Sep 22, 2018
@artee666
Copy link
Author

I've played with it and it started to work when I removed the weight=bold from font-0.

@artee666
Copy link
Author

Alright... weight should be actually style. So first line should be:
font-0 = Hack:pixelsize=10:style=bold;2
Although the weight was working with previous versions of fontconfig

@patrick96
Copy link
Member

patrick96 commented Sep 22, 2018

Really strange that fc produces a segfault for that. Can you try to run the segfaulting config with FC_DEBUG=1 polybar to see if that gives any further information.

EDIT: Please also post the output of fc-match -v Hack:pixelsize=10:weight=bold
EDIT2: And the output of fc-pattern Hack:pixelsize=10:weight=bold

@patrick96
Copy link
Member

Oh and it seems like we already had an issue for this: #1337.

@artee666
Copy link
Author

fc-match -v 'Hack:pixelsize=10:weight=bold'
Unable to parse the pattern

fc-pattern 'Hack:pixelsize=10:weight=bold'
Unable to parse the pattern

FC_DEBUG=1 polybar main
warn: No monitor specified, using "HDMI-1"
FC_DEBUG=1
zsh: segmentation fault (core dumped) FC_DEBUG=1 polybar main

@patrick96 patrick96 added the bug label Sep 22, 2018
@patrick96
Copy link
Member

Just as I thought.
In font.hpp:259, FcNameParse returns NULL and FcDefaultSubstitute segfaults when given a null-pointer.

We will need to check if pattern is valid before we call FcDefaultSubstitute. I will implement a fix as soon as I get the time.

patrick96 added a commit to patrick96/polybar that referenced this issue Oct 2, 2018
If FcNameParse returns NULL FcDefaultSubstitute segfaults

We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.

Fixes polybar#1435
NBonaparte pushed a commit that referenced this issue Nov 1, 2018
If FcNameParse returns NULL FcDefaultSubstitute segfaults

We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.

Fixes #1435
patrick96 added a commit to patrick96/polybar that referenced this issue Nov 17, 2018
If FcNameParse returns NULL FcDefaultSubstitute segfaults

We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.

Fixes polybar#1435
patrick96 added a commit that referenced this issue Dec 23, 2018
### Breaking Changes:
None

### Changelog

**New Config Options**
The following config options were added

In the `[settings]` section:
* `pseudo-transparency`

In `internal/cpu`:
* `ramp-coreload-spacing`, spacing between elements in `<ramp-coreload>` elements
* `%percentage-sum%` in `label`. Shows sum of all percentages

In `custom/script`:
* `double-click-left`
* `double-click-middle`
* `double-click-right`

In `internal/pulseaudio`:
* `interval`, volume increase and decrease steps in percentage points

In `internal/memory`:
* `bar-swap-used`
* `bar-swap-free`
* `ramp-swap-used`
* `ramp-swap-free`

**Deprecations**
* `tray-transparent` in the bar section is no longer used. The tray now always uses pseudo-transparency

**Features**
* volume: adjustable volume steps (#1364), see #1361
* memory: Add progress bars and ramps for swap (#1325)
* render: pseudo-transparency (always used in the tray)  (#595)
* cpu: 
    * Configurable spacing in between coreloads (#1472), see #1389
    * Non-normalized cpu load (#1517), see #1516
* script: Double click actions (#1442)
* net: Support for bridge interfaces (#1528), see #1522
* token: zero pad tokens when min-width value starts with a `0` (#1341), see #1332

**Fixes**
* config: Use font patterns detected on system in sample config (#1350)
* net: Disconnected module when SSID is only an emoji (#1371), see #1367
* tray: Tray overlapping with bar (#1392), see #591
* build: Several build errors (#1395, #1454, #1470, polybar/xpp#12, #1493), see #1447, #1469, #750, #1492
* mpd: format-online-prefix not working (#1402), see #1399
* font: Crash for some font-patterns (#1451), see #1435
* script: 
    * Only `%counter%` or `%pid%` token usable, never both (#1456)
    * click actions with colons in them (#1457), see #984
* renderer: Bar locks up when xorg composite extension is disabled (#1430), see #1425
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants