Fork of the aerc email client (https://sr.ht/~rjarry/aerc)
Go to file
Simon Ser 5feb7dede9 lib/ui: fix Grid race condition
This was is more complicated than others. The cells list is accessed by
multiple goroutines:

- Some change the Grid's contents via AddChild/RemoveChild
- Some call Draw
- Some invalidate the grid via Invalidate

Invalidate calls are tricky to handle because they will also invalidate all
child cells. This will inturn trigger the cellInvalidated callback, which needs
to read the list of cells.

For this reason, we use a sync.RWLock which allows multiple concurrent reads.

Below is the race fixed by this commit.

    Read at 0x00c0000bc3d0 by goroutine 7:
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Grid).cellInvalidated()
          /home/simon/src/aerc2/lib/ui/grid.go:181 +0x45
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Grid).cellInvalidated-fm()
          /home/simon/src/aerc2/lib/ui/grid.go:179 +0x55
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Invalidatable).DoInvalidate()
          /home/simon/src/aerc2/lib/ui/invalidatable.go:22 +0x85
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Bordered).contentInvalidated-fm()
          /home/simon/src/aerc2/lib/ui/borders.go:39 +0x56
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Invalidatable).DoInvalidate()
          /home/simon/src/aerc2/lib/ui/invalidatable.go:22 +0x85
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList.func1()
          /home/simon/src/aerc2/widgets/dirlist.go:81 +0x55
      git.sr.ht/~sircmpwn/aerc2/lib/ui.(*Invalidatable).DoInvalidate()
          /home/simon/src/aerc2/lib/ui/invalidatable.go:22 +0x85
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start.func1()
          /home/simon/src/aerc2/widgets/spinner.go:88 +0x82

    Previous write at 0x00c0000bc3d0 by main goroutine:
      [failed to restore the stack]

    Goroutine 7 (running) created at:
      git.sr.ht/~sircmpwn/aerc2/widgets.(*Spinner).Start()
          /home/simon/src/aerc2/widgets/spinner.go:46 +0x98
      git.sr.ht/~sircmpwn/aerc2/widgets.NewDirectoryList()
          /home/simon/src/aerc2/widgets/dirlist.go:37 +0x28b
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAccountView()
          /home/simon/src/aerc2/widgets/account.go:49 +0x5ca
      git.sr.ht/~sircmpwn/aerc2/widgets.NewAerc()
          /home/simon/src/aerc2/widgets/aerc.go:60 +0x807
      main.main()
          /home/simon/src/aerc2/aerc.go:65 +0x33e
2019-05-05 01:06:39 -04:00
commands Fix segfault on :select-message for unloaded messages 2019-04-17 20:02:12 -04:00
config Use better regex for identifying patches 2019-03-31 16:48:05 -04:00
contrib Add script for sandboxing w3m 2019-03-31 15:33:07 -04:00
lib lib/ui: fix Grid race condition 2019-05-05 01:06:39 -04:00
widgets lib/msgstore: protect with a mutex 2019-04-29 09:49:48 -04:00
worker worker/imap: use the IMAP connection from a single goroutine 2019-04-29 09:49:22 -04:00
.gitignore Initialize worker in account widget 2019-01-13 13:03:28 -05:00
LICENSE Add README.md, update license (MIT -2019) 2019-01-13 20:09:07 -05:00
README.md Update README.md 2019-03-21 22:07:03 -04:00
aerc.go Add message view commands, :close 2019-03-30 21:45:41 -04:00
go.mod Update go-imap to 1.0.0-beta.4 2019-04-29 09:29:41 -04:00
go.sum Update go-imap to 1.0.0-beta.4 2019-04-29 09:29:41 -04:00

README.md

aerc

aerc is a work in progress email client for your terminal.

It is not yet suitable for daily use.

Building

go build

Usage

$ mkdir ~/.config/aerc
$ cp config/*.conf ~/.config/aerc/
$ vim ~/.config/aerc/accounts.conf

Fill in your account details and configure the rest to taste, then run aerc2.

Contributing

Send patches to ~sircmpwn/public-inbox@lists.sr.ht.

Bugs & todo here: ~sircmpwn/aerc2