I kept looking into this, and still haven't found what might be causing it.

However, I was trying to "salvage" that until I find a solution, and
run a "healthcheck" to be sure that the GlorpSession has an active
connection, and then I found that a P3Client reports as connected even
when it's not.

I connected to a PostgreSQL database running in a Docker container,
stopped the container, and the driver continues to report as
connected, even way after the server was stopped (the timeout is using
the default 10 seconds).

The ZdcSocketStream reports both ends of the socket as connected, when
the server side certainly isn't.

I noticed also that in P3Client>>connect it calls #ensureOpen, and it
takes the socket as open when it is not, so as soon as it tries to
flush the data written to it, a `CannotWriteData` exception is
signaled.

In my case I'm developing on Pharo 8 on Windows with PostgreSQL
running in Docker on WSL2 (ubuntu), but on the server it is a 100%
Linux deployment.

Any ideas?

Esteban A. Maringolo

On Mon, Aug 10, 2020 at 5:44 PM Esteban Maringolo <emaring...@gmail.com> wrote:
>
> Looking at the Postgres side of the log I find that the connection was
> reset from the other side (it is Pharo).
>
> The reason for that is yet unknown to me. Since I don't do anything
> (that I'm aware of).
>
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:02:35.939 UTC
> [132] LOG:  could not receive data from client: Connection reset by
> peer
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:06:58.083 UTC
> [139] LOG:  could not receive data from client: Connection reset by
> peer
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:06:58.083 UTC
> [137] LOG:  could not receive data from client: Connection reset by
> peer
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:33:20.163 UTC
> [166] LOG:  could not receive data from client: Connection reset by
> peer
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:35:22.019 UTC
> [168] LOG:  could not receive data from client: Connection reset by
> peer
> golfware_database.1.9sl4bt9j6cv5@gw    | 2020-08-10 20:37:33.091 UTC
> [177] LOG:  could not receive data from client: Connection reset by
> peer
>
> I'll have to keep looking.
>
> Best regards!
>
> Esteban A. Maringolo
>
>
> On Mon, Aug 10, 2020 at 5:35 PM Esteban Maringolo <emaring...@gmail.com> 
> wrote:
> >
> > My Seaside session isn't closing the connection, only when
> > unregistered, but this seems to be something else I don't know.
> >
> > I saw there is logging, and I need to set it up in general (including
> > Fuel serialized stacks).
> > Looking in the web apparently there is the need for a keepalive that
> > is not in place.
> > What disturbs me is that it doesn't happen in development. Making things 
> > harder.
> >
> > Regards!
> >
> > Esteban A. Maringolo
> >
> > On Mon, Aug 10, 2020 at 5:02 PM Sven Van Caekenberghe <s...@stfx.eu> wrote:
> > >
> > > Hi Esteban,
> > >
> > > I have a web app with P3 under Seaside in production and it works fine. 
> > > But that is without Glorp, nor any connection pooling.
> > >
> > > You say the connection seems closed, maybe the closing got triggered by 
> > > your app somehow ? How do you clean up expired sessions ? How do you 
> > > handle logouts ?
> > >
> > > P3 does normally reconnect automatically, IIRC.
> > >
> > > You could try to enable logging in P3Client, that is a recent addition. 
> > > It should show you what happens to your connections.
> > >
> > > Sven
> > >
> > > > On 10 Aug 2020, at 21:15, Esteban Maringolo <emaring...@gmail.com> 
> > > > wrote:
> > > >
> > > > Hi all, Sven ;-)
> > > >
> > > > I'm having erratic P3 errors in a recent application I wrote using
> > > > Pharo, Seaside and Glorp with P3 as driver.
> > > >
> > > > Each Seaside session has a GlorpSession, which in turn has a
> > > > P3Connection in its accessor. I don't know why, but sometimes the
> > > > P3Connection socket is closed, and then when trying to read from the
> > > > database, it cannot write the query to the P3 socket and exception is
> > > > raised, and it isn't handled by the P3DatabaseDriver (automatically
> > > > trying to reconnect?).
> > > >
> > > > I don't know if I'm doing something wrong, I plan to migrate the
> > > > GlorpPooledDatabaseAccessor and also use the P3ConnectionPool, but I
> > > > want to be sure that the current setup works of if maybe I'm exceeding
> > > > some limit or timeout that causes the connection to be closed.
> > > >
> > > > Regards!
> > > >
> > > >
> > > > Esteban A. Maringolo
> > > >
> > >
> > >

Reply via email to