Connection question

Поиск
Список
Период
Сортировка
Искать

Connection question

От:
"Bayless Kirtley" <bkirt@cox.net>
Дата:
I have a two-user point-of-sale application on Windows XP PRO. The DB runs
on the cash register. The second user is a manager's computer. They are
connected through a wired router which is also connected to an internet
cable modem. The manager's computer just checks statistics on the DB and
maintains a connection all the time. The cash register application does not
do any network operations and is not even aware of the network.
 
About twice per month, it is necessary to reset the modem and router. This,
of course, loses the manager's connection to the DB. The problem is, it also
seems to break the connection at the cash register. The next time it tries to
record a transaction, it gets the error "Unable to write to the backend" or
something very close to that. The DB itself seems fine as we can restart the
cash register and all is well.
 
Anyone have any idea why this happens? We are running PostgreSQL 8.3.1-1
and the applications are Java 1.6.14.
 
Bayless
 

Re: Connection question

От:
Jonathan Tripathy <jonnyt@abpni.co.uk>
Дата:

On 01/09/10 16:22, Bayless Kirtley wrote:
I have a two-user point-of-sale application on Windows XP PRO. The DB runs
on the cash register. The second user is a manager's computer. They are
connected through a wired router which is also connected to an internet
cable modem. The manager's computer just checks statistics on the DB and
maintains a connection all the time. The cash register application does not
do any network operations and is not even aware of the network.
 
About twice per month, it is necessary to reset the modem and router. This,
of course, loses the manager's connection to the DB. The problem is, it also
seems to break the connection at the cash register. The next time it tries to
record a transaction, it gets the error "Unable to write to the backend" or
something very close to that. The DB itself seems fine as we can restart the
cash register and all is well.
 
Anyone have any idea why this happens? We are running PostgreSQL 8.3.1-1
and the applications are Java 1.6.14.
 
Bayless
 

It would be a good option to replace your entire system. However, if you don't wish to do that, just simply connect the "manager's pc" and cash register with a network switch, which is separate from the router. So when your router restarts, the switch won't do down, so the 2 machines remain connected.

That is only a work around though, and ultimately you'd want a better solution

Cheers

Re: Connection question

От:
Sam Mason <sam@samason.me.uk>
Дата:
On Wed, Sep 01, 2010 at 10:22:20AM -0500, Bayless Kirtley wrote:
> About twice per month, it is necessary to reset the modem and router. This, 
> of course, loses the manager's connection to the DB. The problem is, it also 
> seems to break the connection at the cash register. The next time it tries to 
> record a transaction, it gets the error "Unable to write to the backend" or 
> something very close to that. The DB itself seems fine as we can restart the 
> cash register and all is well.
> 
> Anyone have any idea why this happens? We are running PostgreSQL 8.3.1-1 
> and the applications are Java 1.6.14.

I'd guess you're connecting to PG using the network and not staying
within Windows.  What does your connection string look like?  Getting it
using "localhost" would be my suggestion.

-- 
  Sam  http://samason.me.uk/

Re: Connection question

От:
Craig Ringer <craig@postnewspapers.com.au>
Дата:
On 09/01/2010 11:22 PM, Bayless Kirtley wrote:

> About twice per month, it is necessary to reset the modem and router. This,
> of course, loses the manager's connection to the DB.

With modern OSes, and many much older ones, it's not "of course" at all. 
Windows XP Pro is quite odd in that it breaks TCP/IP connections when an 
interface goes down and comes back up with the same IP address.

Windows 7 even retains my SSH connections, made over wifi, when 
suspended and resumed! They only break if PuTTY tries to send a packet 
while the interface is still down after resume.

Really, resetting a switch, unplugging a network cable and plugging it 
back in, etc shouldn't break TCP/IP connections, unless it triggers the 
connected host to do a new DHCP request, and the DHCP server hands out a 
different  IP. No decent DHCP server will do that, but some cheap and 
nasty modem/router units don't store DHCP leases across a reboot so they 
"forget" their MAC address to IP address mappings.

Anyway, that's a bit of a tangent, since you're on XP Pro and stuck with 
its rather less than ideal handling of connection loss.

> The problem is, it
> also
> seems to break the connection at the cash register. The next time it
> tries to
> record a transaction, it gets the error "Unable to write to the backend" or
> something very close to that.

Is the register application connecting to localhost (127.0.0.1) or to 
the public IP address assigned by DHCP to the register's ethernet 
interface? If the latter, you're being bitten by Windows XP tossing out 
all TCP/IP connections involving that IP.

If you're not sure, the easiest way I can think of to find out is to 
unplug the register from the network, restart the router and see if it 
can still connect. It should be able to.

--
Craig Ringer

Re: Connection question

От:
"Bayless Kirtley" <bkirt@cox.net>
Дата:
Thanks a lot Craig. The register is connecting through localhost so it's not 
that. I
guess I'm not surprised about the Windows thing. I suppose we'll just have 
to
live with it then. Fortunately it doesn't happen too often. But as fate 
would have it,
most often seems when several customers are standing in line trying to pay. 
I tried
initially to get the customer to go Linux instead of Windows but without 
much luck.

Thanks again for the thorough explanation.
Bayless

----- Original Message ----- 
From: "Craig Ringer" 
To: "Bayless Kirtley" 
Cc: "List, Postgres" 
Sent: Wednesday, September 01, 2010 10:08 PM
Subject: Re: [GENERAL] Connection question


> On 09/01/2010 11:22 PM, Bayless Kirtley wrote:
>
>> About twice per month, it is necessary to reset the modem and router. 
>> This,
>> of course, loses the manager's connection to the DB.
>
> With modern OSes, and many much older ones, it's not "of course" at all. 
> Windows XP Pro is quite odd in that it breaks TCP/IP connections when an 
> interface goes down and comes back up with the same IP address.
>
> Windows 7 even retains my SSH connections, made over wifi, when suspended 
> and resumed! They only break if PuTTY tries to send a packet while the 
> interface is still down after resume.
>
> Really, resetting a switch, unplugging a network cable and plugging it 
> back in, etc shouldn't break TCP/IP connections, unless it triggers the 
> connected host to do a new DHCP request, and the DHCP server hands out a 
> different  IP. No decent DHCP server will do that, but some cheap and 
> nasty modem/router units don't store DHCP leases across a reboot so they 
> "forget" their MAC address to IP address mappings.
>
> Anyway, that's a bit of a tangent, since you're on XP Pro and stuck with 
> its rather less than ideal handling of connection loss.
>
>> The problem is, it
>> also
>> seems to break the connection at the cash register. The next time it
>> tries to
>> record a transaction, it gets the error "Unable to write to the backend" 
>> or
>> something very close to that.
>
> Is the register application connecting to localhost (127.0.0.1) or to the 
> public IP address assigned by DHCP to the register's ethernet interface? 
> If the latter, you're being bitten by Windows XP tossing out all TCP/IP 
> connections involving that IP.
>
> If you're not sure, the easiest way I can think of to find out is to 
> unplug the register from the network, restart the router and see if it can 
> still connect. It should be able to.
>
> --
> Craig Ringer 

Re: Connection question

От:
Craig Ringer <craig@postnewspapers.com.au>
Дата:
On 2/09/2010 11:59 PM, Bayless Kirtley wrote:
> Thanks a lot Craig. The register is connecting through localhost so it's
> not that. I
> guess I'm not surprised about the Windows thing. I suppose we'll just
> have to
> live with it then.

I wouldn't be too sure yet.

Did you run the test where you reboot the POS system with the ethernet 
unplugged? Does it still connect to the database OK?

I didn't think XP broke TCP/IP connections to *localhost* when an 
ethernet interface went up or down, unless the connection was to a local 
IP associated with that interface. If you're connected to 127.0.0.1 from 
127.0.0.1 it shouldn't, AFAIK, matter if you lose your wifi/ethernet.

Come to think of it, you might want to check to make sure the local 
Ethernet interface is set to use DHCP. If it's using a static IP, 
Windows might permit that IP to be used to talk to the local host even 
when there's no link on the interface. So - to be sure, you can disable 
the Ethernet interface in the network control panel before your reboot 
for testing.


Anyway, if you really can't make it work properly, there's a simple if 
mildly clumsy workaround. You can prevent XP from realizing it's lost 
its connection to the router by placing another device between the XP 
machine(s) and the router, like a plain old cheap switch. That way 
Ethernet link on the XP machines is never lost when you reboot the 
router - only between the router and the switch, where the XP machines 
can't tell. When the router goes down they lose their DHCP server, but 
that doesn't matter if it comes up again before they try to renew their 
DHCP leases, and for local-to-local traffic that's about all they'll be 
relying on the router for. You could even avoid that by setting static 
IP addresses.

-- 
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

Re: Connection question

От:
"Bayless Kirtley" <bkirt@cox.net>
Дата:

----- Original Message ----- 
From: "Craig Ringer" 
To: "Bayless Kirtley" 
Cc: "List, Postgres" 
Sent: Thursday, September 02, 2010 10:15 PM
Subject: Re: [GENERAL] Connection question


> On 2/09/2010 11:59 PM, Bayless Kirtley wrote:
>> Thanks a lot Craig. The register is connecting through localhost so it's
>> not that. I
>> guess I'm not surprised about the Windows thing. I suppose we'll just
>> have to
>> live with it then.
>
> I wouldn't be too sure yet.
>
> Did you run the test where you reboot the POS system with the ethernet 
> unplugged? Does it still connect to the database OK?
>
> I didn't think XP broke TCP/IP connections to *localhost* when an ethernet 
> interface went up or down, unless the connection was to a local IP 
> associated with that interface. If you're connected to 127.0.0.1 from 
> 127.0.0.1 it shouldn't, AFAIK, matter if you lose your wifi/ethernet.
>
> Come to think of it, you might want to check to make sure the local 
> Ethernet interface is set to use DHCP. If it's using a static IP, Windows 
> might permit that IP to be used to talk to the local host even when 
> there's no link on the interface. So - to be sure, you can disable the 
> Ethernet interface in the network control panel before your reboot for 
> testing.
>
>
> Anyway, if you really can't make it work properly, there's a simple if 
> mildly clumsy workaround. You can prevent XP from realizing it's lost its 
> connection to the router by placing another device between the XP 
> machine(s) and the router, like a plain old cheap switch. That way 
> Ethernet link on the XP machines is never lost when you reboot the 
> router - only between the router and the switch, where the XP machines 
> can't tell. When the router goes down they lose their DHCP server, but 
> that doesn't matter if it comes up again before they try to renew their 
> DHCP leases, and for local-to-local traffic that's about all they'll be 
> relying on the router for. You could even avoid that by setting static IP 
> addresses.
>
> -- 
> Craig Ringer
>
> Tech-related writing at http://soapyfrogs.blogspot.com/

Hmmm, more to consider then. I have not done the test you suggested.
Guess I pounced on the Windows losing TCP/IP prematurely. It has
been a while but I think I set them up for static IP addresses initially. I
did check to be certain it is using localhost though. I will catch a slow
day soon and try your ideas. I'll report the results back soon.

Thanks Craig,
Bayless


FAQ