Jump to content

Recommended Posts

Posted

The reason for this post is to report a problem that can seriously affect the performance of your servers. Some of you maybe have not noticed, ought not to have many people using the buffer at the same time, but in my case 1 week ago, I had two total freezes when the whole server (500-700 players) attempted use the bufer after an event ;D. But I found something, a person is enough to knock over a server, with many people. Looks this code in script both original rin4a's buffer and my version have a problem, but is easy to fix.

 

as you can see in these lines of code, is open a connection to the database but is never closed, every time a user attempted to remove a buff of his scheme, open a new connection that was never closed causing a total server freeze.

 

                          if event == "remove_buff" :
                                      event = eventParam1.split("_")
                                      scheme = event[0]
                                      skill = event[1]
                                      level = event[2]
                                      con=L2DatabaseFactory.getInstance().getConnection()
                                      rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
                                      rem.setString(1, scheme)
                                      rem.setString(2, skill)
                                      rem.setString(3, level)
                                      try : rem.executeUpdate()
                                      except : pass

 

to fix the problem only adds to what I show below  :). thats all!

 

                          if event == "remove_buff" :
                                      event = eventParam1.split("_")
                                      scheme = event[0]
                                      skill = event[1]
                                      level = event[2]
                                      con=L2DatabaseFactory.getInstance().getConnection()
                                      rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
                                      rem.setString(1, scheme)
                                      rem.setString(2, skill)
                                      rem.setString(3, level)
                                      try :
                                                   rem.executeUpdate()
                                                   rem.close()         # <------------ADD----------
                                                   con.close()         # <------------ADD----------
                                      except : pass

 

After this modification, the performance of my server increase substantially (not more freezing, less lagg).

 

PD: I would recommend that only allow certain people to use the buffer for servers with more than 100 users (Use the VIP Option, i used and everything is fine).

 

I added that lines but when server try to load the script i got errors :

 

Failed executing script: C:\server\GameServer\data\scripts\custom\555_NPCBUFFER\

__init__.py. See __init__.py.error.log for details.

 

and in log is :

 

Error on: C:\server\GameServer\data\scripts\custom\555_NPCBUFFER\__init__.py.error.log

Line: -1 - Column: -1

 

Traceback (innermost last):

  (no code object) at line 0

SyntaxError: ('invalid syntax', ('__init__.py', 763, 25, '                        rem.close()'))

 

how it work at you ?

Posted

Anyone know a way to pull the description of the buff for each buff then display it under the icon/button/text for the actual buff?

 

A lot of people have a hard time making schemes because they forget what each one does. I am trying to edit and implement this into the buffer.

Posted

Well this information isn't embedded in the server's core, so you would have to make a new column in the buffers_buff_list table, add the description, and make the script to fetch that information. But there is a down side. You won't be able to list more than lets say 12 buffs per page. There are more than 130 buffs added, of course if you haven't added your own ones. So the script will have 10+ pages, and as far as I know, there can be some weird malfunctions in the HTML file.

Posted

Yeah anything after 9 pages starts getting glitchey...Guess I'll have to do this another way.

Thanks for the quick response Rin4a, I've always loved your buffer.

 

PS: You are everywhere xD

Posted

To be honest, I never took a look at the code of this buffer, that Allen modified. I just went with it, because it seemed to be working quite well. But performance wise - it's a mess. It's like every single script, that is out there, merged into a single file, and I'm not quite happy with that. But anyway - let's get back to my original script. I took some time out from L2j, but meanwhile I was studying pythons advanced features and I understood where I went wrong, while making this buffer. It was a total crap, if we judge it by it's performance. Features were OK. So what do I have in my mind. In this summer, I will try to rewrite this buffer completely. There won't be any stand alone functions, that are being called elsewhere, because I will be using classes. For tech geeks that are out there (yeah, I'm one of them lol) - I will be fully utilizing python's advanced OOP features and I will use string formatting feature, that is really cool.

To give a brief example:

# We will define a dummy variable, only to show, how to output it
dummy_var = "dog"

But for this example, we will output dog in double quotes. How did we do that earlier? Well..

print "I have a \"" + dummy_var + "\" and it's name is Rex"

So we had to concatenate dummy_var in the string and to output quotes, we had to use double double quotes and escape them and that might and will create a mess, but there is an other option, that works the same way, but is much clearer:

print "I have a \"%s\" and it's name is Rex" % dummy_var

We still had to escape double quotes, but if we had a bunch of variables that we would want to concatenate in the string, this method would work much much better.

Don't know why I wrote this, but someone might use it in their script.

Cheers.

Posted

Thats right, and this is important too http://www.skymind.com/~ocrow/python_string/. i will use Method 5 for now in my scripts. Thanks for advice. By the way, I think this method and what you said, can greatly increase the concatenation speed of any code, but implementing it in this buffer, is almost the same :S, this code is based in data base queries for everything (and that's just i try to avoid lately), so the concatenation speed and performance will be bad anyway :).

Posted

Queries ain't that bad, if you handle them correctly. In my old buffer, I used queries all the time, without thinking about the performance, but I will avoid that in my next release. I will fetch all the data from the database, when script will be initialized (when server will be starting) and store them in global arrays. So that way, the data will be there, when I need it, and I won't have to call any queries. In other words, I will be utilizing server's RAM more efficiently. I haven't thought about scheme system, because there might be more than 10k entries in the database, so I guess that I will have to use queries, despite everything, or I could make a dictionary, that will hold player's ID as a key and an array of skill ID's will be passed along. In total, 10k wouldn't be that much of a deal, but we will see..

  • 1 month later...
Posted

Ok I had your buffer working fine but I updated the server to a newer revision and now I get an error.

 

On Gameserver and htm of npc I get this error:

 

C:\Users\Giovanni Amorim\Desktop\magg\gameserver\data\scripts\custom\555_NPCBUFF
ER\__init__.py
Traceback (innermost last):
 (no code object) at line 0
       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

       at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

       at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
       at java.lang.reflect.Constructor.newInstance(Unknown Source)
       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:3562)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
       at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
       at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
       at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.ja
va:2105)
       at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
2264)
       at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewPr
oxyPreparedStatement.java:76)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: com.mysql.jdbc.except
ions.jdbc4.MySQLSyntaxErrorException: Table 'l2j_magg.buffer_scheme_list' doesn'
t exist

       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$437.onAdvEvent(Unknown Source)
       at com.l2jserver.gameserver.model.quest.Quest.notifyEvent(Quest.java:405
)
       at com.l2jserver.gameserver.model.actor.instance.L2PcInstance.processQue
stEvent(L2PcInstance.java:1838)
       at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.
runImpl(RequestBypassToServer.java:259)
       at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run
(L2GameClientPacket.java:93)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)

 

 

 

 

EDIT: I FIXED THE PROBLEM< I FORGOT TO ADD THE TABLES ON THE DATABASE

 

 

 

 

 

 

Guest
This topic is now closed to further replies.



  • Posts

    • @Silvin Thanks    This will be very useful.
    • Hello, everyone. I am an American, looking to start my own server.... I am looking for a dev, to help me build & edit a pride-style server.  Basically, at this point: (being Lineage 2 is a dying game - with botters overtaking) I'm not looking to spend hundreds-thousands of dollars.... Even if it's a cheap not "pride-style" server, I'll be content with that, too. I have everything else as far as Name, Discord, website, and staff - I just need a dev, to help with the files.  Thanks! 🙂 
    • ## SuperPoint Editor   SuperPoint Editor is a practical visual editor for Lineage II PTS 'SuperPoint.bin' files. It is built for people who need to inspect, fix, rebuild, and draw server routes without digging through binary data by hand.   ### What You Can Do   - Open and edit 'SuperPoint.bin' files. - Export BIN data into a readable TXT format. - Save edited data back into a valid BIN file. - Validate routes before saving. - Work with SuperPoint routes, points, directed connections, and path records in tables. - Add, duplicate, delete, and reorder points. - Create direct and reverse connections between route points. - Automatically generate connections between neighboring points. - Edit raw point coordinates: 'X', 'Y', 'Z', 'Index', and 'Delay'. - Keep route names and internal route data organized. - Use either English or Ukrainian interface language.   ### C4 Server Support   Some C4 servers have 'SuperPoint.bin', but do not have 'superpointinfo.txt' in scripts. The editor supports this case directly. When 'superpointinfo.txt' is not found near the BIN file, the editor can open the BIN in C4 mode. In this mode, 'Fstring ID' is disabled because that value belongs to 'superpointinfo.txt', not to the BIN itself. The editor will not generate or modify 'superpointinfo.txt' while working in this mode. This keeps C4 data clean and avoids creating script files that the server does not actually use.   ### superpointinfo.txt Support   For chronicles that do use 'superpointinfo.txt', the editor can load and synchronize it together with the BIN data. When saving, the editor updates route nodes and coordinates while preserving existing metadata such as: - 'npc_name' - 'move_type' - 'fstring_index' - 'social_number' - 'delay' New nodes are generated with safe default values, so existing script metadata is not accidentally wiped.   ### Geodata Tools   The editor can also open converted geodata '.dat' files and display them as a map. This makes route editing much more visual. You can: - Load geodata and inspect the terrain by layer. - Zoom and pan around the map. - Create a new SuperPoint directly from a map cell. - Draw a route by clicking on the geodata. - Drag existing points to new positions. - Automatically snap 'X/Y' to the selected geo cell. - Use the selected geodata layer to fill the point 'Z'. - See all routes on the map or focus only on the selected one. This is especially useful when building new NPC movement paths or correcting bad route coordinates.   ### Connections and Paths   SuperPoint connections are directional. A connection from point '3' to point '2' is not the same as a connection from point '2' to point '3'. The editor makes this explicit by separating: - route points, - directed connections, - and the actual path records used by each connection. For simple cases, it can create direct path records automatically. For more complex movement, you can edit the path points manually. ### Built for Safe Editing The editor includes validation before saving, so common structural problems can be caught before a broken BIN is produced. It also verifies rebuilt BIN files through the converter engine. The goal is simple: edit quickly, but do not silently damage server data.   ### Unknown Field   This small 'Unknown' field is part of the original BIN structure. Most official-looking files keep it as '0', and for regular route editing there is usually no reason to change it. The editor exposes it so nothing from the BIN is hidden or lost. If you do not know exactly what your server uses it for, keep it at '0'. Download
    • NpcGrp não salva no interlúdio e da crítico quando coloca ele no cliente, já testei ele antes.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..