Unclosed connections

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Unclosed connections

Post by Naonah »

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.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
Starter
Posts: 484
Joined: Sat Jan 23, 2010 4:42 pm

Re: Unclosed connections

Post by Starter »

lol? :mrgreen:
I have promises to keep and miles to go before I sleep.
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unclosed connections

Post by _DS_ »

At least connection from line 351 not always closed.
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

_DS_ wrote:At least connection from line 351 not always closed.
this closing (in line 371) is not sufficient? If not, please tell where to close this damn connection :P

Thank you for your help and time.
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unclosed connections

Post by _DS_ »

You closed only in one branch of "if".
Commiter of the shit
public static final int PI = 3.1415926535897932384626433832795;
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

_DS_ wrote:You closed only in one branch of "if".
ahh, yes :P

Once again thank you :)
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

sry for double post but...

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>"')) 
http://pastebin.com/kM9zBDr7

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;
}
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: Unclosed connections

Post by Stake »

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>"
Image
Image
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

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;
}
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: Unclosed connections

Post by Stake »

Even after you removed the "try" line above of it? I mean:

Code: Select all

#try : L2DatabaseFactory.close(conn) --- no need of thisif buffCount == 0 : HTML_MESSAGE += "No buffs are available at this moment!<br>"
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:

Code: Select all

try : L2DatabaseFactory.close(conn)except : pass
And delete also lines 372 and 373, where it closes db connection.
Image
Image
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

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 :)
public void l2jserver ()
{
if (you want l2j server == no problems)
use Linux;
else
use Windows;
}
User avatar
Naonah
Posts: 357
Joined: Sun Apr 04, 2010 11:12 pm

Re: Unclosed connections

Post by Naonah »

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;
}
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: Unclosed connections

Post by Stake »

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.
Image
Image
_DS_
L2j Veteran
L2j Veteran
Posts: 3437
Joined: Wed Apr 30, 2008 8:53 am
Location: Russia

Re: Unclosed connections

Post by _DS_ »

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;
User avatar
achilless
Posts: 153
Joined: Thu Oct 02, 2008 7:40 pm
Location: Russia & Ukraine

Re: Unclosed connections

Post by achilless »

this forum was a normal baffer! look!
it only remains to correct a couple of extra connection to the database! and all!
Post Reply