Re: Unclosed connections
Posted: Sun Oct 10, 2010 7:55 pm
Htmls and icons in .py - this is sad.
Yeah, always makes us cry.qwerty13 wrote:Htmls and icons in .py - this is sad.
This script looks now: http://pastebin.com/qMEHW9cxjaniii wrote:these event dont close connections:
if event == "create" :
if event == "remove_buff" :
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)
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
I did all what you wrote and still the same:/ It is crazySolidSnake wrote:http://l2jserver.com/forum/viewtopic.ph ... =0#p100143
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)
Solved it for me too if I remember right.^^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
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)
Because you opened multiple connections (con, conn). Only 1 connection would be enough for the entire script.Naonah wrote:..so called double closing helped, lol. This python is cool
Could not you tell me that before?Stake wrote:
Because you opened multiple connections (con, conn). Only 1 connection would be enough for the entire script.
What about this:Naonah wrote:Finally fixed.
You helped me a lot so I have to share this strange solution.
..so called double closing helped, lol. This python is coolCode: 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)
![]()
Special thx to SolidSnake.
closed
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)