Fix critical memory safety bugs, improve thread stability, and introduce JSON ownership API - #39
Fix critical memory safety bugs, improve thread stability, and introduce JSON ownership API#39lozatto wants to merge 12 commits into
Conversation
…gement in AmxxEasyHttp module
|
I was experiencing several server crashes that I traced back to missing validations. I also took the opportunity to address two related issues in the same update. I have been testing these changes for about a week now, and since implementing them, we have not experienced any of the crashes mentioned previously. Another issue I fixed was related to cURL. When the server crashed for any reason, EasyHTTP was sometimes unable to recover because there were multiple pending requests during the EasyHTTP module's shutdown/recovery process. After fixing this behavior, I have not experienced the issue again. |
|
@Polarhigh Fixed a critical SIGBUS crash that occurred during ReHLDS/ReGameDLL updates. The issue was caused by calling the engine API CVarGetFloat to check the trace log setting on every single server frame (StartFrame). The module now reads the locally cached cvar_t value directly, which not only prevents memory corruption crashes on engine mismatches but also significantly improves overall server performance. |
|
@Polarhigh If you'd like, instead of using EzJSONOwnership, I can change it for you. However, it has been working well as it is. |
Fix critical memory corruption crashes, resolve OpenSSL thread-safety issues, separate HTTP/FTP session caches, and introduce a safer JSON ownership model for Pawn developers.
What was updated
ezhttp_option_set_body_from_json()native now requires an explicitEzJSONOwnershiptag instead of a rawEzJSONhandle.ezjson_move()orezjson_copy()to pass JSON objects to HTTP options. This forces compiler validation (preventing silent handle misuse) and enables the C++ module to safely consume and invalidate the handle upon a move.ReadCallbackDataandezhttp_option_set_user_datato prevent Out-Of-Bounds (OOB) memory reads and massive heap allocations.What was improved
SIGSEGVduring concurrent HTTPS requests.CURLOPT_NOSIGNALacross all cURL operations to prevent unpredictableSIGALRMcrashes.sv_paused 1) by implementing queue backpressure. Worker threads now block gracefully if the completion queue hits its limit, instead of endlessly hogging RAM.CURLOPT_READFUNCTIONandCURLOPT_WRITEFUNCTION(and theirDATAcounterparts) immediately after FTP transfers, preventing cURL from executing destroyed stack lambdas.https://,ftp://) into the cache key.UrlUtils::GetHostByUrlwhere libcurl host strings were not being freed.CancelAllRequests()) to prevent deadlocks and ensure proper cleanup during plugin unload or map changes.OpenSSL::Crypto.Test improvements
ez_http_test.smato comply with the newezjson_move()ownership API.ezjson_free()calls in the test plugin, as the JSON handle is now inherently consumed and freed by the C++ backend when moved.Documentation
easy_http.incandeasy_http_json.incwere updated with the newEzJSONOwnershiptag and helper stocks.ezjson_move()transfers the ownership to the HTTP request and invalidates the handle on the Pawn side.#20
#32