Raised This Month: $51 Target: $400
 12% 

amxx 1.8.3 code crash


Post New Thread Reply   
 
Thread Tools Display Modes
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 11-28-2017 , 04:28   Re: amxx 1.8.3 code crash
Reply With Quote #11

The RegisterSystem plugin still fails with the same error like in the first post.

It happens 1-2 times a day out of nowhere. It only started when upgraded from amxx 1.8.2 to 1.8.3 dev
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-01-2017 , 15:31   Re: amxx 1.8.3 code crash
Reply With Quote #12

A stack error in this context is likely caused by an infinite loop.

I can reproduce it with this code:

Code:
#include <amxmodx> public plugin_init() {      register_message(get_user_msgid("ShowMenu"), "OnShowMenu")      register_menucmd(register_menuid("Register System Main Menu"), 1023, "HandlerMainMenu") } public OnShowMenu(msgid, dest, id) {     static menu_text[64];     get_msg_arg_string(4, menu_text, charsmax(menu_text))     if (contain(menu_text, "#Team_Select") >= 0)     {         MainMenu(id)         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; } public MainMenu(id) {     show_menu(id, MENU_KEY_1|MENU_KEY_0, "1. My Item", -1, "Register System Main Menu"); } public HandlerMainMenu(id, key) {     if (++key == 1)     {         MainMenu(id);     }     return PLUGIN_HANDLED; }

It's a side-effect of https://bugs.alliedmods.net/show_bug.cgi?id=3199. "show_menu" and "menu_display" closes the currently viewed menu by sending "menuselect 10" on the client. But in CS, at this point (when a player is not yet fully joined), it will ignore this command, and the game will resend a "#Team_Select" message, then the plugin will hook ShowMenu again, sends "show_menu" native, then "menuselect 10", etc. Infinite loop.
__________________

Last edited by Arkshine; 12-01-2017 at 18:44.
Arkshine is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-01-2017 , 21:32   Re: amxx 1.8.3 code crash
Reply With Quote #13

Quote:
Originally Posted by Arkshine View Post
A stack error in this context is likely caused by an infinite loop.

I can reproduce it with this code:

Code:
#include <amxmodx> public plugin_init() {      register_message(get_user_msgid("ShowMenu"), "OnShowMenu")      register_menucmd(register_menuid("Register System Main Menu"), 1023, "HandlerMainMenu") } public OnShowMenu(msgid, dest, id) {     static menu_text[64];     get_msg_arg_string(4, menu_text, charsmax(menu_text))     if (contain(menu_text, "#Team_Select") >= 0)     {         MainMenu(id)         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; } public MainMenu(id) {     show_menu(id, MENU_KEY_1|MENU_KEY_0, "1. My Item", -1, "Register System Main Menu"); } public HandlerMainMenu(id, key) {     if (++key == 1)     {         MainMenu(id);     }     return PLUGIN_HANDLED; }

It's a side-effect of https://bugs.alliedmods.net/show_bug.cgi?id=3199. "show_menu" and "menu_display" closes the currently viewed menu by sending "menuselect 10" on the client. But in CS, at this point (when a player is not yet fully joined), it will ignore this command, and the game will resend a "#Team_Select" message, then the plugin will hook ShowMenu again, sends "show_menu" native, then "menuselect 10", etc. Infinite loop.
Can we make a fix for it?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-02-2017 , 05:48   Re: amxx 1.8.3 code crash
Reply With Quote #14

An immediate solution for this context (when a player is not yet fully joined) is to set "m_iMenu" offset to 0 before calling show_menu().

For AMXX, we need a more generic solution.
__________________
Arkshine is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-04-2017 , 06:36   Re: amxx 1.8.3 code crash
Reply With Quote #15

Quote:
Originally Posted by Arkshine View Post
An immediate solution for this context (when a player is not yet fully joined) is to set "m_iMenu" offset to 0 before calling show_menu().

For AMXX, we need a more generic solution.
I see you created a pull request on github:

https://github.com/alliedmodders/amxmodx/pull/471

If this is merged, the next build basically will have the problem solved?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-04-2017 , 14:21   Re: amxx 1.8.3 code crash
Reply With Quote #16

Yep, usually after reporting a bug, in a span of few days, we get a new build where the problem is fixed
__________________
Depresie is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-04-2017 , 14:59   Re: amxx 1.8.3 code crash
Reply With Quote #17

Unless no one reviews the patch.
__________________
Arkshine is offline
Old 12-04-2017, 15:08
HamletEagle
This message has been deleted by HamletEagle. Reason: nevermind
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-05-2017 , 12:09   Re: amxx 1.8.3 code crash
Reply With Quote #18

Quote:
Originally Posted by Arkshine View Post
Unless no one reviews the patch.
Yeah, I saw nobody reviewed it. Why so?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
Reply



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 08:26.


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