Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amx_fork/threaded crash [Linux] #4

Closed
yoranjj opened this issue Jul 26, 2018 · 17 comments
Closed

amx_fork/threaded crash [Linux] #4

yoranjj opened this issue Jul 26, 2018 · 17 comments

Comments

@yoranjj
Copy link

yoranjj commented Jul 26, 2018

Hey again, not quite sure what the issue here is, but;

I've been looking through the documentation examples and have tried a few. A few work and a few just crash the plugin (server).

Tried using this in a command;

new result;
amx_forked(.result=result)
{
    task_yield(1);
    threaded(sync_explicit)
    {
        thread_sleep(1000);
        print("Thread end");
    }
    print("Fork end"); //after 1 s
}
assert result == 1; //immediately

And I get a crash error;

[01:54:23] [debug] Server crashed due to an unknown error
[01:54:23] [debug] Native backtrace:
[01:54:23] [debug] #0 f72e2371 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[01:54:23] [debug] #1 f72d996d in _ZN18CrashDetectHandler20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[01:54:23] [debug] #2 f72da98d in _ZN18CrashDetectHandler20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[01:54:23] [debug] #3 f72dcd1d in _ZN18CrashDetectHandler7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[01:54:23] [debug] #4 f72e183c in ?? () from plugins/crashdetect.so
[01:54:23] [debug] #5 f76efbd0 in ?? ()
[01:54:23] [debug] #6 f72dc6aa in _ZN18CrashDetectHandler13HandleAMXExecEPii () from plugins/crashdetect.so
[01:54:23] [debug] #7 f72df999 in ?? () from plugins/crashdetect.so
[01:54:23] [debug] #8 f5964406 in ?? () from plugins/streamer.so
[01:54:23] [debug] #9 f564744c in _Z15amx_ExecContextP6tagAMXPiibPN3amx5resetEb () from plugins/PawnPlus.so
[01:54:23] [debug] #10 f5649154 in _Z15amx_ExecContextP6tagAMXPiibPN3amx5resetEb () from plugins/PawnPlus.so
[01:54:23] [debug] #11 f564b9e6 in _ZN5Hooks8amx_ExecEP6tagAMXPii () from plugins/PawnPlus.so
[01:54:23] [debug] #12 706f7264 in ?? () from D��

@yoranjj yoranjj changed the title amx/thread crash [Linux] amx_fork/threaded crash [Linux] Jul 26, 2018
@IS4Code
Copy link
Owner

IS4Code commented Jul 27, 2018

Hmm, I am not able to reproduce the issue. Can you upload the executable so I can inspect it?

@yoranjj
Copy link
Author

yoranjj commented Jul 27, 2018

If I'm right, you mean the compiled .so file?

PawnPlus.zip

@IS4Code
Copy link
Owner

IS4Code commented Jul 27, 2018

The crash is at a regular call to amx_Exec. Does the code crash if you remove the inner threaded block, amx_forked or the streamer? Did the same code also crash for older versions?

@IS4Code
Copy link
Owner

IS4Code commented Jul 27, 2018

I also can't test the .so on my server, since it's missing some symbols. Can you build it with make static and send me the .so?

@yoranjj
Copy link
Author

yoranjj commented Jul 27, 2018

So yeah, the code doesn't crash if I remove the amx_forked block.

PawnPlus.zip

@IS4Code
Copy link
Owner

IS4Code commented Aug 1, 2018

I can't reproduce the issue even with the .so (which works though). Can you please send me the pwn/amx you are testing with?

@yoranjj
Copy link
Author

yoranjj commented Aug 1, 2018

I would love too, but it is fairly large and requires a lot of includes to compile correctly (going for a "modular" approach). Could it be the command processor (Pawn.CMD) that is interfering with PawnPlus?

@IS4Code
Copy link
Owner

IS4Code commented Aug 1, 2018

I don't think the chance is too high, but perhaps you could isolate the issue into a portable filterscript.

You could also test if there is a difference between these pieces of code:

amx_forked(fork_exec)
{
    print("inside");
}
amx_forked(fork_data)
{
    print("inside");
}
amx_forked(fork_machine)
{
    print("inside");
}

@yoranjj
Copy link
Author

yoranjj commented Aug 1, 2018

Yeah, I just found out that it isn't caused by Pawn.CMD. Tried all of the pieces of code you listed and the only one that didn't crash (tested in main()) was fork_data, odd.

@IS4Code
Copy link
Owner

IS4Code commented Aug 1, 2018

Strange... Do you have other plugins that could affect the crash, like JIT for example? Does wait_ms work?

@yoranjj
Copy link
Author

yoranjj commented Aug 1, 2018

wait_ms does work, I'm using the following plugins;

crashdetect.so pawn-redis.so pawncmd.so pawnregex.so pawnraknet.so pawn-memory.so mysql.so sscanf.so streamer.so YSF.so CVector.so PawnPlus.so

@yoranjj
Copy link
Author

yoranjj commented Aug 1, 2018

Okay, apparently crashdetect was the issue, which is weird because it just installs crash handlers and only gets called when a fatal error occurs... so odd.

@IS4Code
Copy link
Owner

IS4Code commented Aug 1, 2018

crashdetect replaces the implementation of AMX with its own, so it basically controls every execution. I was probably using a version which doesn't cause an issue. Mine is CrashDetect v4.15.1.

@IS4Code
Copy link
Owner

IS4Code commented Aug 1, 2018

Okay, I have downloaded the latest version of CrashDetect and now I can reproduce the crash on Windows as well. Thanks for reporting!

@yoranjj
Copy link
Author

yoranjj commented Aug 1, 2018

Anytime! I'll be downgrading to v4.15.1 for now, thanks for the help!

@IS4Code
Copy link
Owner

IS4Code commented Aug 5, 2018

If you can compile the latest commit of CrashDetect, can you check please if it works on Linux for you?

@yoranjj
Copy link
Author

yoranjj commented Aug 13, 2018

Yup, all good now, compiled the latest commit of CrashDetect and used the version of PawnPlus that I statically compiled a way back when we were debugging this.

EDIT: Just wanted to apologize for making you wait this long, busy with something else.

@IS4Code IS4Code closed this as completed Sep 15, 2018
This was referenced Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants