No buffer space available - postgresql

I am using an application in Yii and postgres database. When i run the application on live server(not local system) i am getting this error
"CDbConnection failed to open the DB connection: SQLSTATE[08006] [7] could not connect to server: No buffer space available (0x00002747/10055)
Is the server running on host "localhost" and accepting
TCP/IP connections on port 5432?"
I have 5 active client database. The error not showing every time. How to solve this problem..?

This error message is thrown by PostgreSQL when a Winsock operation returns the error WSAENOBUFS.
Microsoft describes the error as:
No buffer space available.
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
It is a problem of the Windows operating system. I don't know a lot about Windows, but it sounds like a resource shortage.
Maybe there are too many open TCP connections?

Related

SchemaCrawler Error opening socket to server DB2 database

I have tried to connect to a DB2 DB using the command line:
schemacrawler --server=db2 --host=*myhost* --port=*myport* --database=*db2database* --user=*myuser* --password=*mypassword* --info-level=minimum --command=list --log-level=CONFIG
I get the following error:
SchemaCrawler 16.11.7
Error: Could not connect to
jdbc:db2://pathtodb:retrieveMessagesFromServerOnGetMessage=true;, for
user 'user', with properties {}: [jcc][t4][2043][11550][4.28.11]
Exception java.net.ConnectException: Error opening socket to server
myserver on port myport with message: Connection timed out: connect. ERRORCODE=-4499, SQLSTATE=08001
I have the suspicion that there is a problem in the company's firewall that does not let me connect from SchemaCrawler. I can connect to the db with DBeaver from a virtual machine (Saas). Since DBeaver is running SaaS I do not have access to the VM and cannot test from there.
How could I check if the network is blocking SchemaCrawler requests from my local machine (Windows 10 Enterprise 1909)?
Windows-10 includes ping and tracert and nslookup tools (you run these in a CMD window). These ping and tracert may help you determine if there is IP-level connectivity between your Win10 box and the target Db2-server. Refer to any good textbook to learn how to use these tools.
Windows-10 also has its own software-firewall ( run from the start box if you search firewall) which needs you to add a rule to open the relevant port for tcp and udp traffic. Your login may need to have suitable permissions to make changes like this, so in some corporate environments access is restricted. If this is the case, open a ticket with relevant support teams, as that is not a matter for StackOverflow.
If adding such a rule does not fix your symptom, then you should contact the network support people in your company to open the relevant ports or provide another means for you to achieve the goal.
Note also that there are other tools (arguably better tools) to get a DDL report for a Db2 database, including the db2look utility which is present in the Db2 fat client, and also present on Db2-LUW servers. If the Db2-server runs on either i-series or Z/OS then other tools exist for those environments so talk with the relevant administrators.

Firebird Error while i trying to select from one Table

Engine Message:
Unable to complete network request to host "localhost".
Error writing data to the connection.
An existing connection was forcibly closed by the remote host.
I use Flame Robin as a client and Firebird 1.5....
Any suggestions please

PostgreSQL on remote database: No buffer space available (maximum connections reached)?

I'm trying to put a huge data into PostgreSQL (PostGIS for detail).
About 100 scenes, each scene contains 12 bands of raster image. Each image is about 100MB
What I do:
For each scene in scenes (
for each band in scene (
Open connection to postGIS db
Add band
)
SET PGPASSWORD=password
psql -h 192.168.2.1 -p 5432 -U user -d spatial_db -f combine_bands.sql
)
It ran well till scene #46. It causes an error No buffer space available (maximum connections reached)
I run script on Windows 7, my remote server is on Ubuntu 12.04 LTS.
UPDATE: Connect to remote server and run sql file.
This message:
No buffer space available (maximum connections reached?)
comes from a Java exception, not the PostgreSQL server. A java stack trace may be useful to get some context.
If the connection was rejected by PostgreSQL, the message would be:
FATAL: connection limit exceeded for non-superusers
Still it may be that the program exceeds its max number of open sockets by not closing its connections to PostgreSQL. Your script should close each DB connection as soon as it's finished with it, or open just one and reuse it throughout the whole process.
Simultaneaous connections for the same program are only needed when issuing queries in parallel, which doesn't seem to be the case here.

Heroku PostgreSQL Connection reset by peer

We are using PostgreSQL Crane plan, and got a lot of log like this
app postgres - - [5-1] ... LOG: could not receive data from client: Connection reset by peer
We are using about 50 dynos.
Is PostgreSQL running out of connections with bunch of dynos?
Can someone help me explain this case?
Thanks
From what I've found the cause for the errors is the client not disconnecting at the end of the session, or a new connection not being created.
New connection solving the problem:
Postgres error on Heroku with Resque
Explicit disconnection solving the problem:
https://github.com/resque/resque/issues/367 (comment #2)
There's a Heroku FAQ entry on this: Understanding Heroku Postgres Log Statements and Common Errors: could not receive data from client: Connection reset by peer.
Although this log is emitted from postgres, the cause for the error has nothing to do with the database itself. Your application happened to crash while connected to postgres, and did not clean up its connection to the database. Postgres noticed that the client (your application) disappeared without ending the connection properly, and logged a message saying so.
If you are not seeing your application’s backtrace, you may need to ensure that you are, in fact, logging to stdout (instead of a file) and that you have stdout sync’d.

PostgreSQL Connection Error once in a while

Once in a while I face these errors in Postgres.
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
and
org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
My database will work when I restart the server after getting this error.
You could post more about your setup - language and libraries (I suppose it's Java and JDBC), server version, what's its purpose (development or production) etc.
The second error you get is very clear - you exceed the configured number of connections to the server. Check the "max_connections" parameter in the server's configuration and increase it if you have the resources.
The first error AFAICS is a general connection error. I have no idea what could cause this (save for the server crash which I doubt is the case).