processone / tsung

Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc.
http://www.process-one.net/en/tsung/
GNU General Public License v2.0
2.52k stars 404 forks source link

replace httpd_util functions removed in OTP26 #409

Open lyokha opened 2 months ago

lyokha commented 2 months ago

See details here, the removed functions were replaced by proposed erlang functions which existed since very early releases and had the same behavior (I tested that

%%%    ... erlang:integer_to_list(X, 16) returns hex
%%%    values <10 as only 1 character, ie. "0F" is simply returned as
%%%    "F"* ...

), so the change must be ok with older OTP versions too.

On my Fedora 39 with OTP 26 sessions that contain apply_to_content='ts_digest:md5hex' break with

** Reason for termination ==
** {'function not exported',
       [{httpd_util,integer_to_hexlist,"Ô",[]},
        {ts_digest,'-tohex/1-fun-0-',1,
            [{file,"src/tsung/ts_digest.erl"},{line,75}]},
        {lists,map,2,[{file,"lists.erl"},{line,1559}]},
        {ts_digest,tohex,1,[{file,"src/tsung/ts_digest.erl"},{line,77}]},
        {ts_search,match,5,[{file,"src/tsung/ts_search.erl"},{line,142}]},
        {ts_client,handle_data_msg,2,
            [{file,"src/tsung/ts_client.erl"},{line,1150}]},
        {ts_client,handle_info2,3,
            [{file,"src/tsung/ts_client.erl"},{line,251}]},
        {gen_fsm,handle_msg,8,[{file,"gen_fsm.erl"},{line,475}]}]}

(in tsung installed by dnf), and worse, it hugely leaks memory. If I compile tsung from source, I get

$ make
Compiling  src/tsung/ts_digest.erl ... 
src/tsung/ts_digest.erl:75:44: Warning: httpd_util:integer_to_hexlist/1 is removed; use erlang:integer_to_list/2 with base 16 instead
%   75|                   ts_utils:to_lower(padhex(httpd_util:integer_to_hexlist(X)))
%     |                                            ^

This patch fixes the memory leak and the build.