Unclosed connections
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Unclosed connections
If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Number: 4220
L2JDP Revision Number:7668
hmm, something is wrong with closed connections debugging or there is something strange.
I am sure, I have all closed connections and I have GS Console spammed with unclosed conns.
Please tell me where in this script I have unclosed connection?
http://pastebin.com/enyWQ1Uy
Thank you for you time to check this.
Best regards.
» Find Revision
L2J Revision Number: 4220
L2JDP Revision Number:7668
hmm, something is wrong with closed connections debugging or there is something strange.
I am sure, I have all closed connections and I have GS Console spammed with unclosed conns.
Please tell me where in this script I have unclosed connection?
http://pastebin.com/enyWQ1Uy
Thank you for you time to check this.
Best regards.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
-
- Posts: 484
- Joined: Sat Jan 23, 2010 4:42 pm
-
- L2j Veteran
- Posts: 3437
- Joined: Wed Apr 30, 2008 8:53 am
- Location: Russia
Re: Unclosed connections
At least connection from line 351 not always closed.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
public static final int PI = 3.1415926535897932384626433832795;
- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
this closing (in line 371) is not sufficient? If not, please tell where to close this damn connection_DS_ wrote:At least connection from line 351 not always closed.

Thank you for your help and time.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
-
- L2j Veteran
- Posts: 3437
- Joined: Wed Apr 30, 2008 8:53 am
- Location: Russia
Re: Unclosed connections
You closed only in one branch of "if".
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
public static final int PI = 3.1415926535897932384626433832795;
- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
ahh, yes_DS_ wrote:You closed only in one branch of "if".

Once again thank you

public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
sry for double post but...
I have this error lol
http://pastebin.com/kM9zBDr7
I dont know well python and dont know what is wrong..
Thank you.
I have this error lol
Code: Select all
Error on: C:\Documents and Settings\bolo.LOL-805AA799D1C\Pulpit\ServerFreya\gameservertest\data\scripts\custom\buffer\__init__.py.error.logLine: -1 - Column: -1 Traceback (innermost last): (no code object) at line 0SyntaxError: ('invalid syntax', ('__init__.py', 359, 25, '\t\t\tif buffCount == 0 : HTML_MESSAGE += "No buffs are available at this moment!<br>"'))
I dont know well python and dont know what is wrong..
Thank you.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
- Stake
- Posts: 383
- Joined: Sun Mar 23, 2008 9:33 pm
- Location: Hungary
- Contact:
Re: Unclosed connections
Don't close the connection that fast. You use "conn" variable's value at line 362 too. It's not a delayed-running function, so you can put the connection closing method to the end of the function.
Anyway, as I know, python doesn't support direct operators +=, -= and so on. Rather do this:
Anyway, as I know, python doesn't support direct operators +=, -= and so on. Rather do this:
Code: Select all
HTML_MESSAGE = str(HTML_MESSAGE) + "No buffs are available at this moment!<br>"


- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
Stake wrote:Don't close the connection that fast. You use "conn" variable's value at line 362 too. It's not a delayed-running function, so you can put the connection closing method to the end of the function.
Anyway, as I know, python doesn't support direct operators +=, -= and so on. Rather do this:Code: Select all
HTML_MESSAGE = str(HTML_MESSAGE) + "No buffs are available at this moment!<br>"
As you noticed I used operators +=,-= in this script many times but only in this line it throws error.
Anyway I tried like you said but still the same error. It is syntax error only but where?

Thank you.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
- Stake
- Posts: 383
- Joined: Sun Mar 23, 2008 9:33 pm
- Location: Hungary
- Contact:
Re: Unclosed connections
Even after you removed the "try" line above of it? I mean:
You should close the try condition with the except. But I said, you should remove it from that line, and insert it to the end of the function (between line 393-394) like this:
And delete also lines 372 and 373, where it closes db connection.
Code: Select all
#try : L2DatabaseFactory.close(conn) --- no need of thisif buffCount == 0 : HTML_MESSAGE += "No buffs are available at this moment!<br>"
Code: Select all
try : L2DatabaseFactory.close(conn)except : pass


- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
Thank you very much for your help.
Now no errors. I will put this on live server and give a feedback here if all conections are closed
Now no errors. I will put this on live server and give a feedback here if all conections are closed

public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
- Naonah
- Posts: 357
- Joined: Sun Apr 04, 2010 11:12 pm
Re: Unclosed connections
Still the same...
Code: Select all
Unclosed connection! Trace: sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)java.lang.RuntimeException at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:227) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyInstance.invoke(Unknown Source) at org.python.pycode.serializable._pyx1286719552984.onAdvEvent$14(__init__.py:771) at org.python.pycode.serializable._pyx1286719552984.call_function(__init__.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.proxies.main$Quest$12.onAdvEvent(Unknown Source) at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:447) at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1822) at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:221) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62) at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:973) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Unclosed connection! Trace: sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)java.lang.RuntimeException at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:227) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyInstance.invoke(Unknown Source) at org.python.pycode.serializable._pyx1286719552984.viewAllSchemeBuffs$21(__init__.py:448) at org.python.pycode.serializable._pyx1286719552984.call_function(__init__.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.pycode.serializable._pyx1286719552984.onAdvEvent$14(__init__.py:802) at org.python.pycode.serializable._pyx1286719552984.call_function(__init__.py) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.proxies.main$Quest$12.onAdvEvent(Unknown Source) at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:447) at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1822) at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:221) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62) at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:973) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
- Stake
- Posts: 383
- Joined: Sun Mar 23, 2008 9:33 pm
- Location: Hungary
- Contact:
Re: Unclosed connections
In server core, a connection is allowed to be only for 60 seconds. It's the maximum timeout. "Unclosed connection" is thrown otherwise. You haven't closed some db connections properly. Always close connections when:
- you are sure, that it will not be used later
- you are not sure, but the code runs immediately, with no longer delay than runtime
These two cases are almost the same, but in the second case, insert the close() method at the end of the function code.
- you are sure, that it will not be used later
- you are not sure, but the code runs immediately, with no longer delay than runtime
These two cases are almost the same, but in the second case, insert the close() method at the end of the function code.


-
- L2j Veteran
- Posts: 3437
- Joined: Wed Apr 30, 2008 8:53 am
- Location: Russia
Re: Unclosed connections
Just a suggestion: instead of trying to "fix" this horrible piece of code - rewrite it properly in java.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
public static final int PI = 3.1415926535897932384626433832795;
- achilless
- Posts: 153
- Joined: Thu Oct 02, 2008 7:40 pm
- Location: Russia & Ukraine
Re: Unclosed connections
this forum was a normal baffer! look!
it only remains to correct a couple of extra connection to the database! and all!
it only remains to correct a couple of extra connection to the database! and all!