AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   Solved Weird plugin conflict, possibly a bug? (https://forums.alliedmods.net/showthread.php?t=301839)

aron9forever 10-06-2017 12:59

Weird plugin conflict, possibly a bug?
 
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.

fysiks 10-06-2017 18:25

Re: Weird plugin conflict, possibly a bug?
 
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.

aron9forever 10-06-2017 20:32

Re: Weird plugin conflict, possibly a bug?
 
Quote:

Originally Posted by fysiks (Post 2552952)
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.

fysiks 10-07-2017 00:11

Re: Weird plugin conflict, possibly a bug?
 
Quote:

Originally Posted by aron9forever (Post 2552963)
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 (Post 2552963)
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).

Arkshine 10-08-2017 08:59

Re: Weird plugin conflict, possibly a bug?
 
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?

aron9forever 10-08-2017 11:00

Re: Weird plugin conflict, possibly a bug?
 
Quote:

Originally Posted by Arkshine (Post 2553199)
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.

Arkshine 10-08-2017 11:19

Re: Weird plugin conflict, possibly a bug?
 
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?

aron9forever 10-08-2017 11:57

Re: Weird plugin conflict, possibly a bug?
 
Quote:

Originally Posted by Arkshine (Post 2553244)
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.

Arkshine 10-08-2017 12:24

Re: Weird plugin conflict, possibly a bug?
 
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);
}


aron9forever 10-08-2017 13:03

Re: Weird plugin conflict, possibly a bug?
 
Quote:

Originally Posted by Arkshine (Post 2553280)
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


All times are GMT -4. The time now is 12:56.

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