Unclosed connection

Find the proper support area, Saga-Version.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Unclosed connection

Post by angkor_tm »

If you want to receive support we need this info to help you properly.
» Find Revision
L2J Revision Freya last rev:
L2JDP Revision Freya last rev:

Hi!
Where can problemma? Where to dig?

Code: Select all

Unclosed connection! Trace: sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)java.lang.RuntimeException        at com.l2jserver.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:227)        at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:601)        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._pyx1317470639610.onAdvEvent$14(__init__.py:715)        at org.python.pycode.serializable._pyx1317470639610.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$421.onAdvEvent(Unknown Source)        at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:448)        at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1746)        at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:212)        at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62)        at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:1000)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)        at java.lang.Thread.run(Thread.java:722) 
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

Where I have not closed the connection?
buffer.zip
You do not have the required permissions to view the files attached to this post.
User avatar
nonom
L2j Veteran
L2j Veteran
Posts: 649
Joined: Wed Mar 11, 2009 10:34 pm
Location: Magmeld

Re: Unclosed connection

Post by nonom »

Check the line 715

Code: Select all

 con=L2DatabaseFactory.getInstance().getConnection() 
You are getting an Unknown Source error
Image
"There are three kinds of people in this world, those who can count and those who can't"
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Unclosed connection

Post by tukune »

use try finally

:evil: Bad

Code: Select all

conn=L2DatabaseFactory.getInstance().getConnection()xxx = conn.prepareStatement("SELECT ....")blabla...try : L2DatabaseFactory.close(conn)except: pass
:D Good

Code: Select all

try :    conn=L2DatabaseFactory.getInstance().getConnection()    xxx = conn.prepareStatement("SELECT ....")    blabla...finally :    L2DatabaseFactory.close(conn)
Last edited by tukune on Mon Oct 03, 2011 12:19 pm, edited 1 time in total.
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

What I do change in this code?

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()                except : pass            return rebuildMainHtml(st)
Maybe:

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)
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

tukune wrote:use try finally
Thx I try
dreni
Posts: 3
Joined: Wed Sep 28, 2011 12:14 am

Re: Unclosed connection

Post by dreni »

Lol I'm exactly trying to fix the same thing... Did you manage to find out where the error comes from? I think that the whole script has to be "rewritten"...
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

My last version, but Unclose connection still present
Who help plz?
buffer.zip
You do not have the required permissions to view the files attached to this post.
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Unclosed connection

Post by tukune »

:evil: Bad
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

I try this

Code: Select all

try :    conn=L2DatabaseFactory.getInstance().getConnection()    xxx = conn.prepareStatement("SELECT ....")    blabla...finally :    L2DatabaseFactory.close(conn)
But --- in console syntax error...
Maybe you help me? =)
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: Unclosed connection

Post by Stake »

angkor_tm wrote:I try this
try :
    conn=L2DatabaseFactory.getInstance().getConnection()
    xxx = conn.prepareStatement("SELECT ....")
    blabla...
finally :
    L2DatabaseFactory.close(conn)
But --- in console syntax error...
Maybe you help me? =)
That was just a starting example. :)
Image
Image
angkor_tm
Posts: 135
Joined: Fri Nov 19, 2010 1:38 pm

Re: Unclosed connection

Post by angkor_tm »

I now :shock: , I change all script, but after I have many syntax error.
Example:
Before

Code: Select all

def getclassbuff(id):       conn=L2DatabaseFactory.getInstance().getConnection()    getTipo = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffId=\""+id+"\"")    gt=getTipo.executeQuery()    val = 0    if gt :        gt.next()        try : val = gt.getInt("buff_class")        except : pass    try : L2DatabaseFactory.close(conn)    except : pass    return val
After

Code: Select all

def getclassbuff(id):   try :    conn=L2DatabaseFactory.getInstance().getConnection()    getTipo = conn.prepareStatement("SELECT * FROM buffer_buff_list WHERE buffId=\""+id+"\"")    gt=getTipo.executeQuery()    val = 0    if gt :        gt.next()        try : val = gt.getInt("buff_class")        except : passfinally :        L2DatabaseFactory.close(conn)    except : pass    return val
Where I mistake?
User avatar
tukune
Posts: 533
Joined: Sun Mar 29, 2009 2:35 pm
Location: Japan

Re: Unclosed connection

Post by tukune »

Post Reply