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

"Slice index out of range" after some use #66

Closed
alexzeitgeist opened this issue Aug 15, 2024 · 5 comments
Closed

"Slice index out of range" after some use #66

alexzeitgeist opened this issue Aug 15, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@alexzeitgeist
Copy link

After some use - after an hour or so, sometimes more, sometimes less - cortile would regularly crash with the following error:

Aug 15 07:38:47 thinkpad-linux cortile[2683]: panic: reflect: slice index out of range [recovered]
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         panic: reflect: slice index out of range
Aug 15 07:38:47 thinkpad-linux cortile[2683]: goroutine 85 [running]:
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.(*encodeState).marshal.func1()
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:326 +0x6e
Aug 15 07:38:47 thinkpad-linux cortile[2683]: panic({0x83c020, 0x97fc60})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/runtime/panic.go:884 +0x213
Aug 15 07:38:47 thinkpad-linux cortile[2683]: reflect.Value.Index({0x834740?, 0xc000492a08?, 0xc0000a06d8?}, 0x3733323731000000?)
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/reflect/value.go:1414 +0x16d
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.arrayEncoder.encode({0x544475?}, 0xc00011c080, {0x834740?, 0xc000492a08?, 0xd?}, {0x70?, 0x38?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:914 +0xae
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.sliceEncoder.encode({0xc000296c60?}, 0xc00011c080, {0x834740?, 0xc000492a08?, 0xc0004929f0?}, {0xa?, 0x0?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:887 +0x32f
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.structEncoder.encode({{{0xc0003ba000?, 0x2?, 0x1?}, 0xc0003b85a0?}}, 0xc00011c080, {0x878a80?, 0xc0004929f0?, 0x41126b?}, {0x0, 0x1})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:759 +0x1f4
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.ptrEncoder.encode({0xc0005e6000?}, 0xc00011c080, {0x82d6c0?, 0xc0004929f0?, 0x82d6c0?}, {0x11?, 0x0?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:943 +0x21c
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.(*encodeState).reflectValue(0xc0006a3c30?, {0x82d6c0?, 0xc0004929f0?, 0x8ea42b?}, {0x40?, 0xec?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:358 +0x78
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.(*encodeState).marshal(0xc0002c6db5?, {0x82d6c0?, 0xc0004929f0?}, {0x0?, 0x43?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:330 +0xfa
Aug 15 07:38:47 thinkpad-linux cortile[2683]: encoding/json.Marshal({0x82d6c0, 0xc0004929f0})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /opt/hostedtoolcache/go/1.20.14/x64/src/encoding/json/encode.go:161 +0xe5
Aug 15 07:38:47 thinkpad-linux cortile[2683]: github.com/leukipp/cortile/v2/input.structToMap({0x82d6c0, 0xc0004929f0})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /home/runner/work/cortile/cortile/input/dbusbinding.go:506 +0x3e
Aug 15 07:38:47 thinkpad-linux cortile[2683]: github.com/leukipp/cortile/v2/input.SetProperty({0x8ce6c3, 0x7}, {0x82d6c0?, 0xc0004929f0?})
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /home/runner/work/cortile/cortile/input/dbusbinding.go:496 +0x59
Aug 15 07:38:47 thinkpad-linux cortile[2683]: github.com/leukipp/cortile/v2/input.event(0xc0003f7840?, 0xc00041a040)
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /home/runner/work/cortile/cortile/input/dbusbinding.go:221 +0x1e5
Aug 15 07:38:47 thinkpad-linux cortile[2683]: created by github.com/leukipp/cortile/v2/input.BindDbus
Aug 15 07:38:47 thinkpad-linux cortile[2683]:         /home/runner/work/cortile/cortile/input/dbusbinding.go:186 +0xbf
Aug 15 07:38:47 thinkpad-linux systemd[2675]: cortile.service: Main process exited, code=exited

cortile.service:

[Unit]
Description=window tiling manager
After=graphical.target

[Service]
Environment=DISPLAY=:0
ExecStart=/usr/local/bin/cortile -cache 0
Restart=on-abnormal

[Install]
WantedBy=default.target

config.toml:

################################################################################
#                                                                              #
#           https://github.com/leukipp/cortile/blob/main/config.toml           #
#                                                                              #
################################################################################

#################################### Tiling ####################################

# Tiling will be enabled on application start if set to true (true | false).
tiling_enabled = true

# Initial tiling layout ("vertical-left" | "vertical-right" | "horizontal-top" | "horizontal-bottom" | "maximized" | "fullscreen").
tiling_layout = "vertical-left"

# An overlay window is displayed for this time period [ms] when the layout was changed (0 = disabled).
#tiling_gui = 1500
tiling_gui = 0

# Menu entries in systray which shows the tiling state as icon ([] = disabled).
# tiling_icon = [
#   ["ACTION", "TEXT"] = ["action strings from [keys] section", "text to show in the menu"],
#   ["", ""] = "show a separator line",
# ]
tiling_icon = [
    ["toggle", "Enabled"],
    ["", ""],
    ["master_increase", "Add Master"],
    ["master_decrease", "Remove Master"],
    ["", ""],
    ["slave_increase", "Add Slave"],
    ["slave_decrease", "Remove Slave"],
    ["", ""],
    ["reset", "Reset"],
    ["exit", "Exit"],
]

#################################### Window ####################################

# Regex RE2 syntax to ignore windows (WM_CLASS string can be found by running `xprop WM_CLASS`).
# window_ignore = [
#   ["WM_CLASS", "WM_NAME"] = ["ignore all windows with this class", "but allow those with this name"]
# ]
window_ignore = [
    ["nm.*", ""],
    ["gcr.*", ""],
    ["polkit.*", ""],
    ["wrapper.*", ""],
    ["lightdm.*", ""],
    ["blueman.*", ""],
    ["pavucontrol.*", ""],
    ["arandr.*", ""],
    ["gnome-calculator.*", ""],
    ["speedcrunch.*", ""],
    ["veracrypt.*", ""],
    ["firefox.*", ".*Mozilla Firefox"],
]

# Maximum number of allowed master windows (0 - 5).
window_masters_max = 3

# Maximum number of allowed slave windows (1 - 5).
#window_slaves_max = 3
window_slaves_max = 2

# How much space should be left between windows (0 - 100).
#window_gap_size = 10
window_gap_size = 0

# Window decorations will be removed if set to false (true | false).
#window_decoration = true
window_decoration = false

################################## Proportion ##################################

# How much to increment/decrement master-slave area (0.0 - 1.0).
proportion_step = 0.01

# Minimum window width/height in proportion to workspace (0.0 - 1.0).
proportion_min = 0.2

##################################### Edge #####################################

# Margin of the tiling area ([top, right, bottom, left]).
edge_margin = [0, 0, 0, 0]

# Margin of the tiling area on primary screen ([top, right, bottom, left]).
edge_margin_primary = [0, 0, 0, 0]

# Width and height of a hot-corner area within the edge corners (0 - 100).
edge_corner_size = 4

# Width or height of a hot-corner area within the edge centers (0 - 100).
edge_center_size = 100

################################################################################
[colors]                             # RGBA color values used for ui elements. #
################################################################################

# Layout window text color.
gui_text = [255, 255, 255, 255]

# Layout window background color.
gui_background = [30, 30, 40, 255]

# Layout slave client rectangle color.
gui_client_slave = [58, 58, 78, 255]

# Layout master client rectangle color.
gui_client_master = [98, 98, 128, 255]

# Systray icon background color.
icon_background = [0, 0, 0, 0]

# Systray icon foreground color.
icon_foreground = [255, 255, 255, 255]

################################################################################
[keys]                            # Key symbols can be found by running `xev`. #
################################################################################

# Enable tiling on the current screen (Home = Fn_Left).
enable = "Control-Shift-Home"

# Disable tiling on the current screen (End = Fn_Right).
disable = "Control-Shift-End"

# Disable tiling and restore windows on the current screen.
restore = "Control-Shift-R"

# Toggle between enable and disable on the current screen.
toggle = "Control-Shift-T"

# Reset layouts to default proportions (BackSpace = Delete_Left)
reset = "Control-Shift-BackSpace"

# Cycles through next layouts (Next = Page_Down).
cycle_next = "Control-Shift-Next"

# Cycles through previous layouts (Prior = Page_Up).
cycle_previous = "Control-Shift-Prior"

# Activates the maximized layout (Space = Blank).
layout_maximized = "Control-Shift-Space"

# Activates the fullscreen layout (Space = Blank).
# layout_fullscreen = "Control-Shift-Return"

# Activates the vertical-left layout (Left = Arrow_Left).
layout_vertical_left = "Control-Shift-Left"

# Activates the vertical-right layout (Right = Arrow_Right).
layout_vertical_right = "Control-Shift-Right"

# Activates the horizontal-top layout (Up = Arrow_Up).
layout_horizontal_top = "Control-Shift-Up"

# Activates the horizontal-bottom layout (Down = Arrow_Down).
layout_horizontal_bottom = "Control-Shift-Down"

# Make the active window a master (KP_5 = Num_5).
#master_make = "Control-Shift-KP_5"
master_make = "Control-Shift-2"

# Make the next window a master (KP_6 = Num_6).
#master_make_next = "Control-Shift-KP_6"
master_make_next = "Control-Shift-3"

# Make the previous window a master (KP_4 = Num_4).
#master_make_previous = "Control-Shift-KP_4"
master_make_previous = "Control-Shift-1"

# Increase the number of masters (KP_Add = Num_+).
master_increase = "Control-Shift-KP_Add"

# Decrease the number of masters (KP_Subtract = Num_-).
master_decrease = "Control-Shift-KP_Subtract"

# Increase the number of slaves (Plus = +).
slave_increase = "Control-Shift-Plus"

# Decrease the number of slaves (Minus = -).
slave_decrease = "Control-Shift-Minus"

# Increase the proportion of master-slave area (KP_3 = Num_3).
#proportion_increase = "Control-Shift-KP_3"
proportion_increase = "Mod1-Right"

# Decrease the proportion of master-slave area (KP_1 = Num_1).
#proportion_decrease = "Control-Shift-KP_1"
proportion_decrease = "Mod1-Left"

# Moves focus to the next window (KP_2 = Num_2).
#window_next = "Control-Shift-KP_2"

# Moves focus to the previous window (KP_8 = Num_8).
#window_previous = "Control-Shift-KP_8"

# The commands above will affect all screens if this key is pressed in addition (Mod1 = Alt_L).
mod_screens = "Mod1"

# The commands above will affect all workspaces if this key is pressed in addition (Mod4 = Super_L).
mod_workspaces = "Mod4"

################################################################################
[corners]                   # Action strings from [keys] or external commands. #
################################################################################

# Corner at top left.
#top_left = "window_previous"
top_left = ""

# Corner at top center.
top_center = ""

# Corner at top right.
top_right = "master_make"

# Corner at center right.
center_right = ""

# Corner at bottom right.
#bottom_right = "proportion_increase"
bottom_right = ""

# Corner at bottom center.
bottom_center = ""

# Corner at bottom left.
#bottom_left = "proportion_decrease"
bottom_left = ""

# Corner at center left.
center_left = ""

################################################################################
[systray]                   # Action strings from [keys] or external commands. #
################################################################################

# Icon left click with pointer.
click_left = ""

# Icon middle click with pointer.
click_middle = ""

# Icon right click with pointer.
click_right = ""

# Icon vertical scroll up with pointer.
scroll_up = "cycle_previous"

# Icon vertical scroll down with pointer.
scroll_down = "cycle_next"

# Icon horizontal scroll left with pointer.
scroll_left = "proportion_decrease"

# Icon horizontal scroll right with pointer.
scroll_right = "proportion_increase"

Currently running cortile v2.5.0-ad15ebd.

@leukipp leukipp self-assigned this Aug 15, 2024
@leukipp leukipp added the bug Something isn't working label Aug 15, 2024
leukipp added a commit that referenced this issue Aug 15, 2024
@leukipp
Copy link
Owner

leukipp commented Aug 15, 2024

Seems related: owasp-amass/amass#566 (comment)
I just made a commit on the develop branch, which could fix this.

Please follow the install instructions for development and install cortile from remote branch:

go install github.com/leukipp/cortile/v2@develop

Edit: The install instructions are outdated. Please use "go install github.com/leukipp/cortile/v2@develop".

Since I'm in the middle of development the branch may be unstable or incompatible with your current config.toml.
But give it a try and let me know if the crash still occurs.

@alexzeitgeist
Copy link
Author

Thanks! Installed, will let you know how it goes.

PS: Regarding the config, true, I noticed immediately that window_decoration = false currently has no effect. :P

@leukipp
Copy link
Owner

leukipp commented Aug 16, 2024

I think I was to fast and the update will not help.
Please run go install again with the latest develop branch, as I did a lot of changes to the codebase, which could fix this problem to.

PS: Regarding the config, true, I noticed immediately that window_decoration = false currently has no effect. :P

See #62 (comment), last sentence.

@leukipp
Copy link
Owner

leukipp commented Aug 16, 2024

Please check v2.5.1.

@alexzeitgeist
Copy link
Author

@leukipp have been using cortile v2.5.1 for several hours and not a single crash. :)

@leukipp leukipp closed this as completed Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants