Skip to content

Instantly share code, notes, and snippets.

@3rdp
Last active August 22, 2021 11:30
Show Gist options
  • Save 3rdp/dca687639249025cb270bb82cb5b929d to your computer and use it in GitHub Desktop.
Save 3rdp/dca687639249025cb270bb82cb5b929d to your computer and use it in GitHub Desktop.
redbean 1.4 cache bug (seems to affect all html files except index.html)
going to update the file
D2021-08-22T03:52:47.871283:tool/net/redbean.c:1839:redbean-1:74710] indexing assets (inode 0xf79b5b)
cmd+r
D2021-08-22T03:53:06.587155:tool/net/redbean.c:5353:redbean-1:74731] 127.0.0.1:63870 LOOPBACK read 618 bytes
I--------------------000027:tool/net/redbean.c:4949:redbean-1:74731] RECEIVED 127.0.0.1:63870 LOOPBACK HTTP11 GET http://localhost:8080/hello.html "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0"
D--------------------000006:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/localhost/hello.html")
D--------------------000003:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/www.localhost/hello.html")
D--------------------000002:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/hello.html")
D--------------------000003:tool/net/redbean.c:5297:redbean-1:74731] "/hello.html" latency 46µs
2
D2021-08-22T03:53:21.346114:tool/net/redbean.c:5353:redbean-1:74731] 127.0.0.1:63870 LOOPBACK read 618 bytes
I--------------------000026:tool/net/redbean.c:4949:redbean-1:74731] RECEIVED 127.0.0.1:63870 LOOPBACK HTTP11 GET http://localhost:8080/hello.html "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0"
D--------------------000005:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/localhost/hello.html")
D--------------------000002:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/www.localhost/hello.html")
D--------------------000002:tool/net/redbean.c:4984:redbean-1:74731] RoutePath("/hello.html")
D--------------------000003:tool/net/redbean.c:5297:redbean-1:74731] "/hello.html" latency 44µs
responds with outdated cached file, try hard reload
cmd+shift+r
D2021-08-22T03:54:07.927304:tool/net/redbean.c:4528:redbean-1:74731] 127.0.0.1:63870 LOOPBACK disconnect with 5 requests handled
D--------------------000025:tool/net/redbean.c:5469:redbean-1:74731] 127.0.0.1:63870 LOOPBACK closing after 219,618,945µs
D2021-08-22T03:54:07.927527:tool/net/redbean.c:1109:redbean-1:74710] 74731 exited (0 workers remain)
I--------------------000032:tool/net/redbean.c:1206:redbean-1:74710] resource report for pid 74731
ballooned to 340kb in size
needed 700µs cpu (58% kernel)
caused 93 page faults (100% memcpy)
13 context switches (46% consensual)
received 5 messages and sent 5
D--------------------001377:tool/net/redbean.c:5467:redbean-1:74742] 127.0.0.1:65205 LOOPBACK accepted
D--------------------000097:tool/net/redbean.c:5353:redbean-1:74742] 127.0.0.1:65205 LOOPBACK read 585 bytes
I--------------------000109:tool/net/redbean.c:4949:redbean-1:74742] RECEIVED 127.0.0.1:65205 LOOPBACK HTTP11 GET http://localhost:8080/hello.html "http://localhost:8080/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0"
D--------------------000012:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/localhost/hello.html")
D--------------------000004:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/www.localhost/hello.html")
D--------------------000003:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/hello.html")
D--------------------000013:tool/net/redbean.c:5137:redbean-1:74742] ServeAssetZipIdentity("text/html")
D--------------------000005:tool/net/redbean.c:5297:redbean-1:74742] "/hello.html" latency 150µs
D--------------------018300:tool/net/redbean.c:5353:redbean-1:74742] 127.0.0.1:65205 LOOPBACK read 482 bytes
I--------------------000024:tool/net/redbean.c:4949:redbean-1:74742] RECEIVED 127.0.0.1:65205 LOOPBACK HTTP11 GET http://localhost:8080/favicon.ico "http://localhost:8080/hello.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0"
D--------------------000006:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/localhost/favicon.ico")
D--------------------000003:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/www.localhost/favicon.ico")
D--------------------000002:tool/net/redbean.c:4984:redbean-1:74742] RoutePath("/favicon.ico")
D--------------------000012:tool/net/redbean.c:2427:redbean-1:74742] ServeAssetPrecompressed()
D--------------------000002:tool/net/redbean.c:5297:redbean-1:74742] "/favicon.ico" latency 54µs
D2021-08-22T03:56:02.900260:tool/net/redbean.c:4528:redbean-1:74742] 127.0.0.1:65205 LOOPBACK disconnect with 2 requests handled
D--------------------000052:tool/net/redbean.c:5469:redbean-1:74742] 127.0.0.1:65205 LOOPBACK closing after 114,971,657µs
D2021-08-22T03:56:02.900449:tool/net/redbean.c:1109:redbean-1:74710] 74742 exited (0 workers remain)
I--------------------000022:tool/net/redbean.c:1206:redbean-1:74710] resource report for pid 74742
ballooned to 340kb in size
needed 551µs cpu (66% kernel)
caused 93 page faults (100% memcpy)
8 context switches (25% consensual)
received 2 messages and sent 2
now we got our up-to-date file
also interesting to see what happens if:
* you do 2 quick hard reloads together, I think sometimes you can make it return up-to-date file on 2nd hard reload
* you re-start the server, I think then you need 2 normal reloads to get your up-to-date file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment