Jump to content
  • 0

Question

Posted

Hello,

maybe some one had this error?:

java.sql.SQLException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)
	at org.mariadb.jdbc.pool.Pool.getPoolConnection(Pool.java:382)
	at org.mariadb.jdbc.MariaDbPoolDataSource.getConnection(MariaDbPoolDataSource.java:79)
	at net.sf.l2j.commons.pool.ConnectionPool.getConnection(ConnectionPool.java:47)
    .....
    ...
    ..
    ..
    .
    

what can cause this error? Can't figure out

it start appear only maybe after half a day. Only in game server, on login server everything fine.
acis 401

 

what i have tried:

  1. Update mariadb connector to 3.1.2 ver.
  2. Restart vps.
  3. reinstall mariadb

14 answers to this question

Recommended Posts

  • 0
Posted
2 hours ago, Trance said:


It's unusual to have connection issues on localhost. When this happens, check your computer's memory and processor usage. If they're too high, it might cause timeouts. Also, look at your MySQL settings, especially max_allowed_packet and wait_timeout. If they're too low, increase them. Have you changed any settings before?
 

Poorly written queries can also cause connection issues. You can perform a Java Flight Recording: https://maxcheaters.com/topic/247610-jdk-mission-control-performance-analysis-tool/

I think i found where is problem.

 

// with this i get errors (No connection available within the specified time (option 'connectTimeout': 30,000 ms)

private void updateDatabase()
{
   try {
      Connection con = ConnectionPool.getConnection();
      PreparedStatement stm = con.prepareStatement("DELETE FROM dungeon");
      stm.executeUpdate();
   }catch (Exception e)
   {
      e.printStackTrace();
   }
}

// with this no errors

private void updateDatabase()
{
	try(Connection con = ConnectionPool.getConnection()) {
	 PreparedStatement stm = con.prepareStatement("DELETE FROM dungeon");
	 stm.executeUpdate();
	}catch (Exception e)
	{
	e.printStackTrace();
	}
}

 

who can explain why? 😄

  • 0
Posted

check your mariadb logs in vps, it might give you the reason, also if it only starts to appear after half a day, you might exceed max connections of mariadb and it blocks any further connections, by default it's set to 150, and if you added some custom to 401 acis it might not be closing them properly.
in this case you can increase the amount based on your need.

you can check current max connections with 

SHOW VARIABLES LIKE "max_connections";


you can also run below which will shows current connections and max used connections since mariadb session started:
 

show status where variable_name = 'threads_connected' OR variable_name = 'max_used_connections';


hope this helps.

  • 0
Posted
3 minutes ago, Friko said:

check your mariadb logs in vps, it might give you the reason, also if it only starts to appear after half a day, you might exceed max connections of mariadb and it blocks any further connections, by default it's set to 150, and if you added some custom to 401 acis it might not be closing them properly.
in this case you can increase the amount based on your need.

you can check current max connections with 

SHOW VARIABLES LIKE "max_connections";


you can also run below which will shows current connections and max used connections since mariadb session started:
 

show status where variable_name = 'threads_connected' OR variable_name = 'max_used_connections';


hope this helps.

No players in server.

max connections: 256.

active coneections: 3

max_used_connections: 70

 

so problem not there. and in mariadb logs no errors 

  • 0
Posted

Ensure that the following information in your server properties is accurate: the database URL, login credentials, and password.  If you are using Linux, it's a good idea to verify if any firewall rules might be blocking the loopback interface (lo) for localhost, as this could be the cause of the issue.

  • 0
Posted
54 minutes ago, wongerlt said:

No players in server.

max connections: 256.

active coneections: 3

max_used_connections: 70

 

so problem not there. and in mariadb logs no errors 


players don't need to be in server to drain max connections in some packs.

then check if db user itself has rate limits enabled, I would assume db is in local vps as your gameserver, so no limits are needed as long as you use it only for server itself.
database connections per hour, user connections per hour etc.
if you copied some guides how to create DB user they may have included rate limiters.

  • 0
Posted
37 minutes ago, Friko said:


players don't need to be in server to drain max connections in some packs.

then check if db user itself has rate limits enabled, I would assume db is in local vps as your gameserver, so no limits are needed as long as you use it only for server itself.
database connections per hour, user connections per hour etc.
if you copied some guides how to create DB user they may have included rate limiters.

there no limits for user.

https://prnt.sc/eJB2oWTgdo8G

1 hour ago, Trance said:

Ensure that the following information in your server properties is accurate: the database URL, login credentials, and password.  If you are using Linux, it's a good idea to verify if any firewall rules might be blocking the loopback interface (lo) for localhost, as this could be the cause of the issue.

db url:
jdbc:mariadb://127.0.0.1:3306/SERVER_DB?user=hidden&password=hidden

everything fine with user/pass/db.

im using linux it have iptables and firewalld but everything fine here.

10 minutes ago, Trance said:

 

Temporarily stop them.

 

sudo systemctl stop firewalld
sudo systemctl stop iptables

 

hm, i will try, now i enabled all logs which i found , will see tomorrow

  • 0
Posted
34 minutes ago, wongerlt said:

there no limits for user.

https://prnt.sc/eJB2oWTgdo8G

db url:
jdbc:mariadb://127.0.0.1:3306/SERVER_DB?user=hidden&password=hidden

everything fine with user/pass/db.

im using linux it have iptables and firewalld but everything fine here.

 

Temporarily stop them:

 

sudo systemctl stop firewalld
sudo systemctl stop iptables


Check if localhost can reach MySQL on port 3306:

 

mysql -u root -h localhost -p<your password> -e "SELECT 'Connected Successfully'"

  • 0
Posted
8 minutes ago, Trance said:

 

Temporarily stop them:

 

sudo systemctl stop firewalld
sudo systemctl stop iptables


Check if localhost can reach MySQL on port 3306:

 

mysql -u root -h localhost -p<your password> -e "SELECT 'Connected Successfully'"

 

yes localhost and 127.0.01 connect successfully. Like i said error start throwing only after some hours.

  • 0
Posted
5 minutes ago, wongerlt said:

yes localhost and 127.0.01 connect successfully. Like i said error start throwing only after some hours.

 

That is not normal. However, you can increase connection timeout to 60 seconds for testing purposes.
 

jdbc:mariadb://127.0.0.1:3306/SERVER_DB?connectTimeout=60000?user=hidden&password=hidden


All you can do is wait for the logging results.

  • 0
Posted
4 hours ago, wongerlt said:

yes localhost and 127.0.01 connect successfully. Like i said error start throwing only after some hours.

so you db is up , ls is still online without any problem but your gs is having trouble connecting to db sometimes ?

  • 0
Posted
6 hours ago, wongerlt said:

yes localhost and 127.0.01 connect successfully. Like i said error start throwing only after some hours.

Can u share your linux distro and if you have applied any settings on it?

  • 0
Posted
9 hours ago, LoVe+ said:

so you db is up , ls is still online without any problem but your gs is having trouble connecting to db sometimes ?

yes.

13 hours ago, Trance said:

 

That is not normal. However, you can increase connection timeout to 60 seconds for testing purposes.
 

jdbc:mariadb://127.0.0.1:3306/SERVER_DB?connectTimeout=60000?user=hidden&password=hidden


All you can do is wait for the logging results.

i got one error:
[Warning] Aborted connection 3 to db: 'SERVER_DB' user: 'root' host: 'localhost' (Got timeout reading communication packets)

  • 0
Posted (edited)
5 hours ago, wongerlt said:

yes.

i got one error:
[Warning] Aborted connection 3 to db: 'SERVER_DB' user: 'root' host: 'localhost' (Got timeout reading communication packets)


It's unusual to have connection issues on localhost. When this happens, check your OS' RAM and CPU usage. If they're too high, it might cause timeouts. Also, look at your MySQL settings, especially max_allowed_packet and wait_timeout. If they're too low, increase them. Have you changed any settings before?
 

Poorly written queries can also cause connection issues. You can perform a Java Flight Recording: https://maxcheaters.com/topic/247610-jdk-mission-control-performance-analysis-tool/

Edited by Trance
  • 0
Posted (edited)
12 minutes ago, wongerlt said:

I think i found where is problem.

 

// with this i get errors (No connection available within the specified time (option 'connectTimeout': 30,000 ms)

private void updateDatabase()
{
   try {
      Connection con = ConnectionPool.getConnection();
      PreparedStatement stm = con.prepareStatement("DELETE FROM dungeon");
      stm.executeUpdate();
   }catch (Exception e)
   {
      e.printStackTrace();
   }
}

// with this no errors

private void updateDatabase()
{
	try(Connection con = ConnectionPool.getConnection()) {
	 PreparedStatement stm = con.prepareStatement("DELETE FROM dungeon");
	 stm.executeUpdate();
	}catch (Exception e)
	{
	e.printStackTrace();
	}
}

 

who can explain why? 😄

 

It is closing the connection automatically because the Connection object is being created within the try block.

Edited by Trance
  • Thanks 1
  • Haha 1
Guest
This topic is now closed to further replies.
  • Posts

    • Server mid rate craft PvP   CLIENTE INTERLUDE Website server Discord olympus x25 &nbsp;server 🇧🇷🇦🇷🇨🇱🇬🇷🇲🇽🇵🇪🇸🇰🇪🇸🇺🇾 Server mid rate craft PvP 🔱CLIENTE INTERLUDE🔱 🔅xpx25 🔅Sp x25 🔅Adena x15 🔅Droop x2 🔅Spoil x2 🔅Raidboss xp x2 🔅Raidboss sp x2 🔅Raidboss droop x1 🔅All Rate quest reward  x1 ⚠️All Quest drop reward. x1 🔅Manor x 3 🔅Seal stone x1 🛡️🗡️INFO GRADO S🗡️🛡️ ⚠️Inicia desabilitado drop/spoil/quest. 🔱PROFESIONES/SUBCLASS🔱 🛡️1st profession - 50medal 🛡️2nd profession - 500 medal 🛡️3rd profession - 1k medal +30kk adena 🛡️Sub class - Quest. No necesita matar raids. ⚙️Configuraciones⚙️ 🛡️Gmshop  grade - B. 🛡️Grade A-S Craft - yes x1 chance 🛡️Globlal teleport - yes 🛡️Buffer 1hora. 🛡️Buffer slot 24(+4divine)+12 dances-song 🛡️Auto learn skils - yes 🛡️Autoloot - yes 🛡️Mana potion recarga 1000 ,9segundos delay. 🛡️Champions system:     ▫️lvl 30 - 76     ▫️chance respawn 0.5%.     ▫️adena x20 🛡️Max lvl party 14 lvl. 🛡️Festive sweeper on. 🛡️Max client pc 2. 🛡️Raid boss respawn retail. 🛡️Nobleza quest - yes. 🛡️Barakiel respawn 6 horas + -30 min. 🛡️Olimpiada duracion 14 dias. 🛡️Olimpiada de 18:00 a 00:00 🛡️Safe enchant +3 🛡️Normal enchant scroll 50% ⚠️+11-16 chance 30% 🛡️Bleesed enchant scroll 55% ⚠️+11-16 chance 35% 🛡️Rate dinamico x1 lvl 77-80   🛡️🗡️CLANES INFO🗡️🛡️ 🔅Crear clan min. level 20 🔅Max Alianzas 1 🔅Duracion penalidades clan / alianzas 8 horas. 🔅Cambio de lider 24 horas. 🛡️⚔️ ASEDIOS ⚔️🛡️ 🔅Cada 2 semanas. 🔅Proteccion hwid 1 pc. 🔅Clanes registrados. acceden a zona de asedio. 🔅Castillo asediable Aden. 🔅Reward 1000 FA 🔅Horario 16:00 GMT-3 🎊PACK DE INICIO🎊 🔅Start set - armor\weapon no grade. 🔅Level 20  - 5 shadow cuppon grado D 🔅Level 40 - 5 shadow cuppon grado C 🔅Free Autofarm 24 horas. 💰 INFO PREMIUM 💰 🔅Free autofarm. 🔅xp x30 🔅sp x30 🔅adena x17 🔅drop x4 🔅spoil x4 🔅enchant +2% 🔅seal stone x1 🔅Altb Gk-Gmshop/buffe ⚔️ RAID  BOSS INFO ⚔️ 🔅Raid boss 70 ++ respawn 5 días despues. 🔅Raid boss 75 ++ respawn 15 días despues 🔅Drop LETTER L2DAY para tradear en GMshop. ⚔️ INFO SEVEN SING ⚔️ 🔅Inicio del drop Seal stones dia 5 de iniciado el server. 🎊 EPIC RAID INFO 🎊 🔅Queen Ant (lvl 40)respawn Lunes a Viernes 22:00 GMT-3 drop chance 30%. 🔅Core (lvl 80)respawn Martes-miercoles 20:20 GMT-3 drop chance 100%. 🔅Orfen (lvl 80)respawn Martes-miercoles 21:00 GMT-3 drop chance 100%. 🔅Zaken (lvl 80)respawn Jueves 23:00 GMT-3 drop chance 100%. 🔅Frintezza (lvl 80)respawn Viernes 23:00 GMT-3 drop chance 100%. 🔅Baium (lvl 80)respawn Sabado 22:00 GMT-3 drop chance 100%. 🔅Valakas (lvl 80)respawn Domingo 20:00 GMT-3 drop chance 100%. 🔅Antharas (lvl 80)respawn Domingo 22:00 GMT-3 drop chance 100%.
    • The server is running in l2house.com.ar with C4 mode and in L2Tekila within the same login you can also test it in C5, if you want me to raise another chronicle to test, just let me know.
    • video nice song TopGear  gaming 1990    ....  
    • I have a system where Accounts are saved on login screen for fast login. I am playing a server where this feature is not on the logic screen. How I can try to add this feature to the system? I don't know what files I would have to touch.   Thanks!!
  • Topics

×
×
  • Create New...