Page 2 of 4

Re: Unclosed connections

Posted: Sun Oct 10, 2010 7:55 pm
by qwerty13
Htmls and icons in .py - this is sad.

Re: Unclosed connections

Posted: Sun Oct 10, 2010 8:21 pm
by Stake
qwerty13 wrote:Htmls and icons in .py - this is sad.
Yeah, always makes us cry.

Re: Unclosed connections

Posted: Sun Oct 10, 2010 8:34 pm
by Naonah
Well, I tested more this crap :D

so...

When I have this setting like: ENABLE_SCHEME_SYSTEM = False , all is OK - all connections are closed, no errors.

..but when I set this to TRUE , I have spam of unclosed connections and mysgl error, lol - so the problem is only under this condition.

Please help me with this damn Python :) cuz I have no idea what to do :)

Thank you.

Re: Unclosed connections

Posted: Sun Oct 10, 2010 8:43 pm
by janiii
these event dont close connections:
if event == "create" :
if event == "remove_buff" :

Re: Unclosed connections

Posted: Sun Oct 10, 2010 8:47 pm
by Naonah
janiii wrote:these event dont close connections:
if event == "create" :
if event == "remove_buff" :
This script looks now: http://pastebin.com/qMEHW9cx

and still... unclosed connections. Maybe I do something wrong? I give up :P

Code: Select all

2010-10-10 23:43:55 com.l2jserver.L2DatabaseFactory$ConnectionCloser runWARNING: Unclosed connection! Trace: sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)java.lang.RuntimeException    at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:227)    at sun.reflect.GeneratedMethodAccessor12.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._pyx1286746889859.onAdvEvent$14(__init__.py:788)    at org.python.pycode.serializable._pyx1286746889859.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)

Re: Unclosed connections

Posted: Mon Oct 11, 2010 10:22 am
by Naonah
Sry for double post but I think I am close to solve this :)

I lost half a day for this crap script and reworked it.

Here this script: http://pastebin.com/juRHcDkF

...but I have this mysql error:( Can you tell me what is wrong here? Thank you.

Code: Select all

C:\Documents and Settings\bolo.LOL-805AA799D1C\Pulpit\ServerFreya\gameserver\data\scripts\custom\555_buffer\__init__.pyTraceback (innermost last):  (no code object) at line 0        at sun.reflect.GeneratedConstructorAccessor92.newInstance(Unknown Source)        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)        at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)        at com.mysql.jdbc.Util.getInstance(Util.java:384)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)        at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntaxto use near ') ORDER BY buff_class ASC' at line 1         at org.python.core.Py.JavaError(Unknown Source)        at org.python.core.PyObject._jthrow(Unknown Source)        at org.python.core.PyObject._jcall(Unknown Source)        at org.python.proxies.main$Quest$21.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) Traceback (innermost last):  (no code object) at line 0        at sun.reflect.GeneratedConstructorAccessor92.newInstance(Unknown Source)        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)        at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)        at com.mysql.jdbc.Util.getInstance(Util.java:384)        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2275)        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)        at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)        at java.lang.reflect.Method.invoke(Method.java:597) com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntaxto use near ') ORDER BY buff_class ASC' at line 1
Best regards.

Re: Unclosed connections

Posted: Mon Oct 11, 2010 11:07 am
by SolidSnake

Re: Unclosed connections

Posted: Mon Oct 11, 2010 1:51 pm
by Naonah
I did all what you wrote and still the same:/ It is crazy :cry:

Please have a look and tell me where is error http://pastebin.com/c1xpkRh8

And here error:

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._pyx1286804555000.onAdvEvent$14(__init__.py:708)        at org.python.pycode.serializable._pyx1286804555000.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$15.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)

Re: Unclosed connections

Posted: Mon Oct 11, 2010 2:05 pm
by SolidSnake
So you're using another buffer's version.. I have the Rin4a's epilogue scheme buffer and I solved this problem with those lines... There is another error for 'create' command at line 708

Re: Unclosed connections

Posted: Mon Oct 11, 2010 2:07 pm
by Starter
SolidSnake wrote:So you're using another buffer's version.. I have the Rin4a's epilogue scheme buffer and I solved this problem with those lines
Solved it for me too if I remember right.^^

Re: Unclosed connections

Posted: Mon Oct 11, 2010 7:01 pm
by Naonah
Finally fixed.

You helped me a lot so I have to share this strange solution.

Code: Select all

        if event == "create" :            con=L2DatabaseFactory.getInstance().getConnection()            param = eventParam1.replace("."," ")            if param == "no_name" :                return showText(st,"Info","Please, enter the scheme name!","True","Return","main")            else :                ins=con.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)")                ins.setString(1, str(st.player.getObjectId()))                ins.setString(2, param)                try :                    ins.executeUpdate()                    ins.close()                    con.close()                    L2Databasefactory.close(con)                except : pass            return rebuildMainHtml(st)
..so called double closing helped, lol. This python is cool :D

Special thx to SolidSnake.

closed

Re: Unclosed connections

Posted: Mon Oct 11, 2010 7:15 pm
by Stake
Naonah wrote:..so called double closing helped, lol. This python is cool :D
Because you opened multiple connections (con, conn). Only 1 connection would be enough for the entire script.

Re: Unclosed connections

Posted: Mon Oct 11, 2010 8:02 pm
by Naonah
Stake wrote:
Because you opened multiple connections (con, conn). Only 1 connection would be enough for the entire script.
Could not you tell me that before? :P

Anyway I thank you too.

Re: Unclosed connections

Posted: Sat Oct 16, 2010 11:54 am
by Starter
Naonah wrote:Finally fixed.

You helped me a lot so I have to share this strange solution.

Code: Select all

        if event == "create" :            con=L2DatabaseFactory.getInstance().getConnection()            param = eventParam1.replace("."," ")            if param == "no_name" :                return showText(st,"Info","Please, enter the scheme name!","True","Return","main")            else :                ins=con.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)")                ins.setString(1, str(st.player.getObjectId()))                ins.setString(2, param)                try :                    ins.executeUpdate()                    ins.close()                    con.close()                    L2Databasefactory.close(con)                except : pass            return rebuildMainHtml(st)
..so called double closing helped, lol. This python is cool :D

Special thx to SolidSnake.

closed
What about this:

Code: Select all

         if event == "create" :            conn = L2DatabaseFactory.getInstance().getConnection()            param = eventParam1.replace("."," ")            if param == "no_name" :                return showText(st,"Info","Please, enter the scheme name!","True","Return","main")            else :                ins = conn.prepareStatement("INSERT INTO buffer_scheme_list (player_id,scheme_name) VALUES (?,?)")                ins.setString(1, str(st.player.getObjectId()))                ins.setString(2, param)                try :                    ins.executeUpdate()                    ins.close()                    conn.close()                except :                    try : conn.close()                    except : pass            return rebuildMainHtml(st)

Re: Unclosed connections

Posted: Sat Oct 16, 2010 4:28 pm
by Naonah
I tried this and got syntax error, lol. Only this construction I wrote as last works :D