Closed leif closed 10 years ago
This was with the latest master, 69c407829265982f968a3e84f3e38d1e7dc3d2aa
Do you have a log file? Can you enable logging and see if it happens again?
I don't have a log file. I'll enable logging.
I remembered that I did something else in this session before the OTR conversation: I attempted to start an OTR session with someone I don't know who requested presence notifications from me some time ago and I received the "?OTRv2?" error from the server (as has happened previous times I've attempted to start an OTR session with them).
Here's the crashing code in question:
func (t *Terminal) writeLine(line []rune) {
for len(line) != 0 {
remainingOnLine := t.termWidth - t.cursorX
todo := len(line)
if todo > remainingOnLine {
todo = remainingOnLine
}
t.queue(line[:todo])
t.advanceCursor(visualLength(line[:todo]))
line = line[todo:]
}
}
And it's crashing on t.queue(line[:todo])
. So either cursorX > termWidth or there's a race. I can't see that the former can happen so can you build xmpp-client with go build -race
and use that binary? It should dump any detected races. Normally the race detector is quite a lot of overhead, but for a network-bound program with xmpp-client should should be almost invisible.
@leif, by any chance, were you using a tiling window manager on that system that had the crash? Can you open a new terminal with bash in it and do trap -- 'echo size changed' SIGWINCH
, and then try resizing the window in various ways (with hotkeys and/or mouse or whatever your WM uses) and see what will cause the "size changed"
message to print?
Update: That trap has trouble triggering even on a super normal Ubuntu 14.04 system with Gnome and gnome-terminal, so it seems to not be limited to tiling WMs.
@agl I think there is a way in which the updateTerminalWidth
handler for SIGWINCH is not properly getting called (because the signal isn't happening), causing, in some cases, cursorX > termWidth.
I had this crash a second time a few days ago. I unfortunately haven't built with -race
yet, but I did enable logs. Strangely though, the log seemed to have stopped being written some time before the crash (based on the pattern of sent and received messages, it seemed to be missing my last 10+ minutes of conversation).
@isislovecruft yes, I'm using dwm. It appears that SIGWINCH is firing once each time the window size is changed by any means (including when it jumps from a large size to a very small size).
I also tried jumping the window to a very small size while the cursor is very far to the right; this did not reproduce the crash but does cause several lines of whitespace to be incorrectly inserted above the current input line.
I also tried jumping the window to a very small size while the cursor is very far to the right; this did not reproduce the crash but does cause several lines of whitespace to be incorrectly inserted above the current input line.
Does using or not using UTF-8/Unicode characters make a difference?
I just tried a few experiments resizing with a long line of unicode in the input buffer and haven't reproduced the crash yet. But, it is sometimes overwriting previous lines of conversation like it used to do before the semi-recent terminal library fixes.
I can reliably reproduce this crash now with these two steps:
>
+ space) so the cursor is in the 22nd column (counting from 1).Another note: the traceback I posted originally was from an old build (69c407829265982f968a3e84f3e38d1e7dc3d2aa), but I just confirmed that the bug is still reproducible using the latest version (919dd8dcc9cd6d45200609064b5b3ca0e305f99c) which includes @isislovecruft's changes to the prompt.
I found a much easier way to reproduce this crash, and without using dwm (I tested with metacity; I assume it is not window-manager dependent):
Simply resize the window so that it is narrower than the prompt, and then type something.
go get -u code.google.com/p/go.crypto/ssh/terminal and rebuilding Pond should fix this.
rebuilding Pond should fix this
rebuilding xmpp-client helps too :)
Fix works for me. Thanks!
I just had my first-ever xmpp-client crash. Prior to crashing I'd had one OTR conversation, which the other party ended, and then a number of presence messages. Server is jabber.ccc.de.