Raised This Month: $32 Target: $400
 8% 

Solved Weird plugin conflict, possibly a bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-06-2017 , 12:59   Weird plugin conflict, possibly a bug?
Reply With Quote #1

Hi, I'm back with another weird problem encountered while developing a mod.
I'm having a weird conflict between two plugins that seemingly should have nothing to do with each other.
The first plugin simply sets the lights on plugin_init.
The second plugin sets full flags on my steamID on putinserver.
When both plugins run, the light keeps changing on the server (think a slower lightning effect).

https://www.youtube.com/watch?v=8mTMYk8E-9s (set to max quality, it's a large resolution video)
if you want to skip the bull, just skim through the video, I'm mostly just explaining what I already wrote here.

Testing environment is the same as in https://forums.alliedmods.net/showthread.php?t=301737 except reHLDS was installed (problem was present on original as well, tried reHLDS first to see if it's some weird engine bug before realizing it was poweradmin).

Here's the sample code:
Code:
#include <amxmodx> #include <engine> public plugin_init() {   set_lights("g"); }

Code:
#include <amxmodx> #pragma semicolon 1 static const PLUGIN_NAME[] = "Power Admin Tool", PLUGIN_AUTHOR[] = "Carnacior", PLUGIN_VERSION[] = "1.0"; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); } public client_putinserver(id) {     new auth[35];     get_user_authid(id, auth, charsmax(auth));     if(equal(auth,"STEAM_0:0:18855539"))     {         new flags = read_flags("bcdefghijklmnopqrstu");         set_user_flags(id,flags);     } }

Just to clear things up, I'm not doing anything shady here, I use the admin tool to get command access easily on multiple installations without editing the actual admin list. I wrote it when someone with SQL Admins asked for help and I wanted quick access without messing with his DB to be able to test.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by Arkshine; 10-09-2017 at 08:41.
aron9forever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-06-2017 , 18:25   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #2

What version of AMX Mod X? If you are using the dev version, you should test it with the latest stable release (1.8.2) to see if it still happens there (or vice versa).

P.S. There is no guarantee that get_user_authid() will return a SteamID in client_putinserver() IIRC. You must use client_authorized() to ensure that the player has been properly authenticated with a SteamID.
__________________
fysiks is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-06-2017 , 20:32   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
What version of AMX Mod X? If you are using the dev version, you should test it with the latest stable release (1.8.2) to see if it still happens there (or vice versa).

P.S. There is no guarantee that get_user_authid() will return a SteamID in client_putinserver() IIRC. You must use client_authorized() to ensure that the player has been properly authenticated with a SteamID.
what's the worst that can happen, a failed string check against "STEAM_ID_PENDING"?
I changed from putinserver to authorized, same results


I checked and the issue doesn't happen on 1.8.2
Also, the plugin compiled under 1.8.2 but running on 1.8.3 will still produce the weird light flicker, so I'm guessing maybe a problem with engine module?


Edit::
I know you are right @fysiks, I'm just saying it's sort of unrelated to the issue.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 10-07-2017 at 07:41.
aron9forever is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-07-2017 , 00:11   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #4

Quote:
Originally Posted by aron9forever View Post
what's the worst that can happen, a failed string check against "STEAM_ID_PENDING"?
By definition, the plugin might fail to do what was intended. A plugin is not written well if there is a chance that it will just randomly fail.

Quote:
Originally Posted by aron9forever View Post
I changed from putinserver to authorized, same results
It's the same by chance. Not all the forwards happen in the order (many do but not all).
__________________
fysiks is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-08-2017 , 08:59   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #5

Are you sure it's not happening just because of the first plugin _only_ and that you restart the map?
And you should try a stop/start hlds as well. Also, is reload and restart commands the same?
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-08-2017 , 11:00   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
Are you sure it's not happening just because of the first plugin _only_ and that you restart the map?
And you should try a stop/start hlds as well. Also, is reload and restart commands the same?
I've recorded a bit more exhaustive test, though I'm not sure if it's what you wanted

I started the server with only the first plugin
Joined
changelevel
reload
restart
quit
same result, lights work fine at every step

Enable 2nd plugin, start the server again
Joined
changelevel
reload
restart
same result, lights flicker at every step

Here are the steps done on 1.8.3 with plugin compiled under 1.8.3 https://youtu.be/-kjDm_XE0Ic
I've repeated all the steps under 1.8.2 on the same server with no flickers at all,, unfortunately I had to remove the video because I left some stuff on the screen by mistake.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 10-08-2017 at 11:04.
aron9forever is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-08-2017 , 11:19   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #7

If you start the server with both plugins, lights flicker. At this point, if you comment "set_user_flags(id,flags);", recompile and changemap (or restart command), are lights still flickering?
__________________
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-08-2017 , 11:57   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
If you start the server with both plugins, lights flicker. At this point, if you comment "set_user_flags(id,flags);", recompile and changemap (or restart command), are lights still flickering?
yeap, I've done more digging, apparently the second plugin doesn't really matter as much as it's a valid registered plugin

having the code
Code:
#include <amxmodx> #pragma semicolon 1 static const PLUGIN_NAME[] = "Power Admin Tool", PLUGIN_AUTHOR[] = "Carnacior", PLUGIN_VERSION[] = "1.0"; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR); }
will still produce the same effect
If I comment register_plugin(), recompile and reload the problem goes away.

I went ahead and replaced the order of the plugins in plugins.ini, so now this empty plugin is first and the lights are the last thing executed in the chain of plugin_inits, and the flickering disappeared again. Reversed the order and it came back.

I'm using multiple set_lights on my production server, but the only one in plugin_init is date conditional(once a year) and hasn't been executed since I updated to 1.8.3, the others only happen on certain events during the game. There are many plugins registered afterwards and there's no problem.

ps: I can't be sure that I'm not contaminating the tests somehow. I'm trying to be as clean as possible but there's always some doubt
I hope that the way the server is reloaded when only the plugin is changed doesn't matter.
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 10-08-2017 at 12:05.
aron9forever is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-08-2017 , 12:24   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #9

What happens if you use register_plugin but that you name your plugin "g"? :p
Maybe there is some weird buffer issue, don't know.

Let me try I guess.

EDIT : I can't reproduce under windows. When I connect with both plugins, lights don't flicker.

Code:
Currently loaded plugins:
       name                    version     author            file             status
 [  1] Power Admin Tool        1.0         Carnacior         random.amxx      running
 [  2] unknown                 unknown     unknown           set_light.amxx   running
2 plugins, 2 running
meta list
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] AMX Mod X        RUN   -    amxmodx_mm.dll    v1.8.3-m  ini  Start ANY
 [ 2] Engine           RUN   -    engine_amxx.dll   v1.8.3-d  pl1  ANY   ANY
2 plugins, 2 running
Code:
#include <amxmodx>
#include <engine>

public plugin_init()
{
    set_lights("g");
}
Code:
#include <amxmodx>

#pragma semicolon 1

static const
PLUGIN_NAME[] = "Power Admin Tool",
PLUGIN_AUTHOR[] = "Carnacior",
PLUGIN_VERSION[] = "1.0";

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
}
__________________

Last edited by Arkshine; 10-08-2017 at 12:36.
Arkshine is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-08-2017 , 13:03   Re: Weird plugin conflict, possibly a bug?
Reply With Quote #10

Quote:
Originally Posted by Arkshine View Post
What happens if you use register_plugin but that you name your plugin "g"? :p
Maybe there is some weird buffer issue, don't know.

Let me try I guess.

EDIT : I can't reproduce under windows. When I connect with both plugins, lights don't flicker.

Code:
Currently loaded plugins:
       name                    version     author            file             status
 [  1] Power Admin Tool        1.0         Carnacior         random.amxx      running
 [  2] unknown                 unknown     unknown           set_light.amxx   running
2 plugins, 2 running
meta list
Currently loaded plugins:
      description      stat pend  file              vers      src  load  unlod
 [ 1] AMX Mod X        RUN   -    amxmodx_mm.dll    v1.8.3-m  ini  Start ANY
 [ 2] Engine           RUN   -    engine_amxx.dll   v1.8.3-d  pl1  ANY   ANY
2 plugins, 2 running
Code:
#include <amxmodx>
#include <engine>

public plugin_init()
{
    set_lights("g");
}
Code:
#include <amxmodx>

#pragma semicolon 1

static const
PLUGIN_NAME[] = "Power Admin Tool",
PLUGIN_AUTHOR[] = "Carnacior",
PLUGIN_VERSION[] = "1.0";

public plugin_init()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
}

Changing the plugin name to d and author to s made the lights flicker slowly again
reverted to original names and went ballistic
I guess that's the smoking gun for an overflow

please add
Code:
register_plugin("Furien: SFX", "0.1", "Carnacior");
to the first plugin and try again, maybe it's related since problem doesn't occur unless second one is registered as well
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode