Socket error (server crash)
(This thread was by accident posted in SourcePawn section. It's deleted and reposted here.)
I made this pretty simple plugin which sends some data via TCP protocol using basic sockets. Most of the time, everything works fine -- plugin successfully sends data to remote server, remote server receives it. However, sometimes (rarerly) this error happens and causes server to crash. Plugin error log http://i.imgur.com/Bg9Skcm.png I do not see origin of this error, neither i see a way to find out what causes this to happen. Does this happen usually when using sockets? If so, is there a method to prevent this from happening or possibility of catching this error before it occurs? Source: PHP Code:
|
Re: Socket error (server crash)
Quote:
|
Re: Socket error (server crash)
Stack/heap size is 4096 cells (16384 bytes) by default, and you've exceeded that amount with your plugin by allocating more memory on stack than you are allowed to (probably with all those huge arrays you have in your plugin). Try adding
PHP Code:
|
Re: Socket error (server crash)
In one of my plugins I use bigger arrays(like 2000 cells), of course I got a stack error, but the solution was to make the vars static so they will be initialized only one time.
@Klippy, the 4096 limit refers to only one variable or it is the sum of all of them ? I had the impression that it is only for one. |
Re: Socket error (server crash)
to have in mind
socket_change will block the server if you use timeout, same for socket_open if not is localhost Quote:
Spoiler
|
Re: Socket error (server crash)
I increased heapsize as KliPPy suggested, and declared those variable in global; static scope as HamletEagle suggested. I'll let the plugin roll on 5-10 cs servers for few days to see if it happens again, thanks.
|
Re: Socket error (server crash)
Quote:
|
All times are GMT -4. The time now is 22:54. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.