starfish-app / Starfish

A Gemini browser for elementary OS.
gemini://josipantolis.from.hr/starfish/
GNU General Public License v3.0
25 stars 2 forks source link

Fix loading of gemini://drewdevault.com #4

Closed Antolius closed 2 years ago

Antolius commented 2 years ago

Observed behavior

Loading of any page from gemini://drewdevault.com succeeds every 1 out of 3 attempts.

First request succeeds and then subsequent 2 fail on TLS handshake. Next request (the 4th one) again succeeds, and so on. Restarting the app resets the success-failure cycle. The cycle continues for any page from Drew's pod, regardless of the path.

Technical details

Here are the events emitted by the GLib.SocketClient.event:

1st request (succeeds):
event               connectable connection
G_SOCKET_CLIENT_RESOLVING   173.195.146.137 null
G_SOCKET_CLIENT_RESOLVED    173.195.146.137 null
G_SOCKET_CLIENT_CONNECTING  173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_CONNECTED   173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_TLS_HANDSHAKING 173.195.146.137 GTlsClientConnectionGnutls
G_SOCKET_CLIENT_TLS_HANDSHAKED  173.195.146.137 GTlsClientConnectionGnutls
G_SOCKET_CLIENT_COMPLETE    173.195.146.137 GTcpWrapperConnection

2nd request (fails):
event               connectable connection
G_SOCKET_CLIENT_RESOLVING   173.195.146.137 null
G_SOCKET_CLIENT_RESOLVED    173.195.146.137 null
G_SOCKET_CLIENT_CONNECTING  173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_CONNECTED   173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_TLS_HANDSHAKING 173.195.146.137 GTlsClientConnectionGnutls
G_SOCKET_CLIENT_RESOLVING   173.195.146.137 null
G_SOCKET_CLIENT_COMPLETE    173.195.146.137 null

3rd request (fails):
event               connectable connection
G_SOCKET_CLIENT_RESOLVING   173.195.146.137 null
G_SOCKET_CLIENT_RESOLVED    173.195.146.137 null
G_SOCKET_CLIENT_CONNECTING  173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_CONNECTED   173.195.146.137 GTcpConnection
G_SOCKET_CLIENT_TLS_HANDSHAKING 173.195.146.137 GTlsClientConnectionGnutls
G_SOCKET_CLIENT_RESOLVING   173.195.146.137 null
G_SOCKET_CLIENT_COMPLETE    173.195.146.137 null

Extra thoughts

Starfish creates a new instance of GLib.SocketClient for each request, so the caching / resource reuse that's causing the bug has to be in lower level code. Since app restart resets the success-error cycle the issue needs to be tied to the application process.

While I first observed the issue by loading gemini://drewdevault.com pages, it might actually impacts all (or at least some of the) sites served by the gmnisrv Gemini server. One other gemsite that I've observed the bug on is gemini://gmi.noulin.net.