benknoble / frosthaven-manager

GUI Frosthaven Scenario Manager
https://benknoble.github.io/frosthaven-manager
Other
11 stars 3 forks source link

Possible race-condition in `rich-text-view` #77

Open benknoble opened 10 months ago

benknoble commented 10 months ago

I haven't confirmed the root cause yet, but I believe what happens is that simultaneous edits (say, one in the GUI and one from the server) cause the editor to try to lock twice. I'll be posting the error message later.

If this double-locking (or really, concurrent modification) is the issue, I could use the context-mixin to associate a Rebellion lock with the editor for mutex semantics. That seems like a performance hit… but I don't think I can just not lock the editor. That seems likely to lead to problems when inserting text.

Given the performance weirdness in #73, this might be a good opportunity to find a better way to "draw" the rich-text-view.

benknoble commented 10 months ago

Error message:

sequence-contract-violation: negative: method insert cannot be called, except in states (unlocked), args (object:string-snip% ...)
  context...:
   /Users/Knoble/code/frosthaven-manager/gui/rich-text-display.rkt:80:0: insert-string-and-apply-styles
   /Users/Knoble/code/frosthaven-manager/gui/rich-text-display.rkt:70:0: draw
   /Users/Knoble/code/frosthaven-manager/gui/rich-text-display.rkt:148:4: redraw
   /Users/Knoble/Library/Racket/8.11.1/pkgs/gui-easy-lib/gui/easy/private/view/container.rkt:22:4: update-children method in container%
   [repeats 2 more times]
   /Applications/Racket v8.11.1/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:436:6
   /Applications/Racket v8.11.1/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:487:32
   /Applications/Racket v8.11.1/collects/racket/private/more-scheme.rkt:148:2: call-with-break-parameterization
   /Applications/Racket v8.11.1/share/pkgs/gui-lib/mred/private/wx/common/queue.rkt:371:11: eventspace-handler-thread-proc
benknoble commented 8 months ago

I haven't been able to reproduce this. I'm going to leave it open, but de-prioritize it and work on other things in the meantime. (It was nasty the one time it occurred, though.)