Ok, adding more details for whoever comes looking for a similar issue, although 
it has nothing to do with `osm2pgsql` directly.

> For the first issue related to the SSL connection being closed unexpectedly, 
> this can occur when the application tries to reuse an idle connection after 
> the Neon compute has been suspended due to inactivity. If you plan to leave a 
> connection idle, it would be good to increment the auto-suspend timer to meet 
> the duration needed, or disable it altogether. The default auto-suspend is 5 
> minutes, and looking at the endpoint activity, it is suspending roughly 5 
> minutes after opening.

This explains the behaviour... the connection is inactive for more than five 
minutes and when the application tries to use it again, it was already dropped. 
To clarify, in this context, we're talking about a direct connection, not 
through the connection pooler.
To workaround this, one can change the default inactivity timeout to a bigger 
value (Neon compute settings). Although this has nothing to do with `osm2pgsql` 
it would be interesting if it did have options for a health check or keep-alive 
mechanism to prevent this from happening.

Regarding the issues with the connection pool, I had opened an 
[issue](https://github.com/osm2pgsql-dev/osm2pgsql/issues/924) before (which I 
didn't remember). Neon uses `pgbouncer`, which doesn't support SQL prepared 
statements. It does however support protocol level prepared statements and 
there's already a 
[discussion](https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2118) open 
requesting for its support.

Hope this helps anyone going through the same issues.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2273#discussioncomment-11530369
You are receiving this because you are subscribed to this thread.

Message ID: 
<osm2pgsql-dev/osm2pgsql/repo-discussions/2273/comments/[email protected]>
_______________________________________________
Tile-serving mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/tile-serving

Reply via email to