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

    • 11-29-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • 🔥 Launch was a success! Over 500 players joined L2Elixir on opening day, and we are holding a steady 420–450 online! We faced extortion attempts and heavy DDoS attacks, but our protections held strong — even if the cost was far higher than expected. What matters is we fought back and kept the server online for you. ⚔️ 💙 Our priority is simple: Deliver a stable, fair, and growing server that will evolve for years to come. We continue to invest in protections, advertising, and development — and we won’t stop. All we ask from YOU is one thing: 👉 Keep playing. The more active the community is, the faster the server grows. 💠 Important Note: We have no paid clans or CPs, no “boosted” groups, no unfair benefits. Everyone has an equal chance to progress and compete. Thank you to everyone who joined, supported, and believed in this project. Let’s make L2Elixir great again — even in 2025–2026! 🚀   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs   @Atom Can you please move to Private Servers? Thanks!
    • https://jumpshare.com/share/kIdeKALOhgtMKpBKqxpg Test Equip Armors-> FullPlate, Gloves, Legs, Chest , Boots
    • 黑色星期五 — 为您的流量提供高级福利 仅在11月28日,我们的特别促销码可为您提供13%的商店折扣。 促销码: BLACKFRIDAY (13% 折扣) 您可以通过我们的网站或 Telegram 机器人在商店购物! 有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram Messenger 方便访问商店。 其他服务: 虚拟号码服务: 前往 用于购买 Telegram Stars 的机器人: 前往 – 快速且优惠地在 Telegram 中购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们向您呈现当前的 促销和特惠活动 列表,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 只需在我们网站注册后发送您的用户名,格式如下:“SEND ME BONUS, MY USERNAME IS...” — 您需要在我们的论坛帖子中写下这句话! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(支持)提交主题为“Get Trial Bonus”的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人每周都会举办 Telegram Stars 抽奖活动! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ 邮箱: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock