wsutil: buffer grow leads to its reduce
Under using chromedp package wich use that lib as dependency got panic in some cases with the follow stack trace
panic: wsutil: buffer grow leads to its reduce
goroutine 42 [running]:
github.com/gobwas/ws/wsutil.(*Writer).Grow(0xc0004c22e8, 0x1b)
/home/max/go/pkg/mod/github.com/gobwas/[email protected]/wsutil/writer.
github.com/gobwas/ws/wsutil.(*Writer).Write(0xc0004c22e8, 0xc000ad4000, 0x8d
/home/max/go/pkg/mod/github.com/gobwas/[email protected]/wsutil/writer.
net.(*Buffers).WriteTo(0xc0328f45c0, 0xee9ec0, 0xc0004c22e8, 0x1ffad, 0x1ffa
/usr/local/go/src/net/net.go:675 +0xd9
github.com/mailru/easyjson/buffer.(*Buffer).DumpTo(0xc0004c2410, 0xee9ec0, 0
/home/max/go/pkg/mod/github.com/mailru/[email protected]/buffer/pool.g
github.com/mailru/easyjson/jwriter.(*Writer).DumpTo(...)
/home/max/go/pkg/mod/github.com/mailru/[email protected]/jwriter/write
github.com/chromedp/chromedp.(*Conn).Write(0xc0004c2240, 0xef56a0, 0xc000928
/home/max/go/pkg/mod/github.com/chromedp/[email protected]/conn.go:137
github.com/chromedp/chromedp.(*Browser).run(0xc0006bb900, 0xef56a0, 0xc00092
/home/max/go/pkg/mod/github.com/chromedp/[email protected]/browser.go:
created by github.com/chromedp/chromedp.NewBrowser
/home/max/go/pkg/mod/github.com/chromedp/[email protected]/browser.go:
%# v &{info systemd 45 0xc0000c8820 0xc0000c8870 0xc0006bc760 0xc000495950}
I think it`s problem with call size in chromedp, but generally lib should detect grow size lower than current without panic.
Related commit that was fixing this https://github.com/gobwas/ws/commit/4b75daf8999178c7bd9a0687cc5bb0613f084237 and PR with a prototype (or so) https://github.com/gobwas/ws/pull/134
@maxjust does the commit mentioned by @cristaloleg (thanks!) works for you now? Can I close this?
@gobwas I cant test it while it's not released, I use this lib as subdependency another lib. Owner of another lib (chromedp) wrote me this:
The issue has been fixed in github.com/gobwas/ws, but it's not released yet. I will update the dependency once github.com/gobwas/[email protected] is released.
Thanks!
So, while you release 1.0.5. I can't test and give the answer
@maxjust there is the latest release candidate (v1.1.0-rc.6) which should contain the fix. If you want, you can test against it, or wait a bit -- I'm planning to release the v1.1.0 on Monday.
@gobwas, thanks for your quick response, I will wait for the monday, and then will write to github.com/chromedp about request to update the lib wich I use.
@maxjust done, v1.1.0 is out 🎉
@maxjust can I close this, or isn't it clear yet? :)
@maxjust I'm going to close it in a few days 👋🏻
Closing (looks like it fixed).