From matthew@REDACTED Mon Feb 4 01:29:36 2008 From: matthew@REDACTED (Matthew Dempsky) Date: Sun, 3 Feb 2008 16:29:36 -0800 Subject: [erlang-bugs] binary_to_term can crash erl Message-ID: Calling binary_to_term can cause the erl interpreter to crash: 1> binary_to_term(iolist_to_binary([<<131, 100, 65000:16>> | lists:duplicate(65000, 42)])). Crash dump was written to: erl_crash.dump absurdly large atom Abort trap I think binary_to_term should instead just kill the process that called binary_to_term, similar to calling list_to_atom on a list that is too large. Also, it's possible to create atoms larger than 255 characters this way. From psa@REDACTED Mon Feb 4 19:12:27 2008 From: psa@REDACTED (=?ISO-8859-1?Q?Paulo_S=E9rgio_Almeida?=) Date: Mon, 04 Feb 2008 18:12:27 +0000 Subject: [erlang-bugs] Internal compiler error handling binaries using macro Message-ID: <47A7558B.2050305@di.uminho.pt> Hi, when writing a parser working on binaries I came across a bug in the compiler. I isolated the error to the code below. This may be related to some error already reported here, for which there was a patch submitted; I am not sure. I am using an unpatched R12B. The problem occurs on the first decode_obj clause. Moreover, if I replace the macro with the commented one, the error disappears. Regards, Paulo --- -module(error). -export([decode_obj/2]). -define(WS(C), (C =:= $\s orelse C =:= $\t orelse C =:= $\n orelse C =:= $\r)). %-define(WS(C), C =:= $\s; C =:= $\t; C =:= $\n; C =:= $\r). decode_obj(<>, Acc) when ?WS(C) -> decode_obj(R, Acc); decode_obj(<<$., _/binary>>, Acc) -> Acc; decode_obj(<>, Acc) -> decode_obj(R, [C | Acc]). From bjorn@REDACTED Tue Feb 5 08:52:48 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 05 Feb 2008 08:52:48 +0100 Subject: [erlang-bugs] Internal compiler error handling binaries using macro In-Reply-To: <47A7558B.2050305@di.uminho.pt> References: <47A7558B.2050305@di.uminho.pt> Message-ID: Paulo S?rgio Almeida writes: > Hi, > > when writing a parser working on binaries I came across a bug in the > compiler. I isolated the error to the code below. This may be related to > some error already reported here, for which there was a patch submitted; Yes, it is. The bug will be corrected in R12B-1. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From goryachev@REDACTED Tue Feb 5 16:00:30 2008 From: goryachev@REDACTED (Igor Goryachev) Date: Tue, 05 Feb 2008 18:00:30 +0300 Subject: [erlang-bugs] bug: Protocol: "inet_tcp": register/listen error: eaddrinuse while starting a node Message-ID: <8763x31m9d.fsf@yandex-team.ru> Hi, everyone! I have noticed some troubles while starting node with '-kernel inet_dist_listen_min 5290 inet_dist_listen_max 5290' options. And everything works fine when these options are omitted. The output is here: =========== {progress,preloaded} {progress,kernel_load_completed} {progress,modules_loaded} {start,heart} {start,error_logger} {start,application_controller} {progress,init_kernel_started} {apply,{application,load,[{application,stdlib,[{description,"ERTS CXC 138 10"},{vsn,"1.14.5"},{id,[]},{modules,[base64,beam_lib,c,calendar,dets,dets_server,dets_sup,dets_utils,dets_v8,dets_v9,dict,digraph,digraph_utils,edlin,edlin_expand,epp,eval_bits,erl_bits,erl_compile,erl_eval,erl_expand_records,erl_internal,erl_lint,erl_parse,erl_posix_msg,erl_pp,erl_scan,erl_tar,error_logger_file_h,error_logger_tty_h,escript,ets,file_sorter,filelib,filename,gb_trees,gb_sets,gen,gen_event,gen_fsm,gen_server,io,io_lib,io_lib_format,io_lib_fread,io_lib_pretty,lib,lists,log_mf_h,math,ms_transform,orddict,ordsets,otp_internal,pg,pool,proc_lib,proplists,qlc,qlc_pt,queue,random,regexp,sets,shell,shell_default,slave,sofs,string,supervisor,supervisor_bridge,sys,timer,win32reg,zip]},{registered,[timer_server,rsh_starter,take_over_monitor,pool_master,dets]},{applications,[kernel]},{included_applications,[]},{env,[]},{start_phases,undefined},{maxT,infinity},{maxP,infinity}]}]}} {progress,applications_loaded} {apply,{application,start_boot,[kernel,permanent]}} {error_logger,{{2008,2,5},{17,18,42}},"Protocol: ~p: register/listen error: ~p~n",["inet_tcp",eaddrinuse]} {error_logger,{{2008,2,5},{17,18,42}},crash_report,[[{pid,<0.21.0>},{registered_name,net_kernel},{error_info,{error,badarg}},{initial_call,{gen,init_it,[gen_server,<0.18.0>,<0.18.0>,{local,net_kernel},net_kernel,{'ejabberd@REDACTED',shortnames,15000},[]]}},{ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[<0.18.0>]},{dictionary,[{longnames,false}]},{trap_exit,true},{status,running},{heap_size,377},{stack_size,21},{reductions,331}],[]]} {error_logger,{{2008,2,5},{17,18,42}},supervisor_report,[{supervisor,{local,net_sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[['ejabberd@REDACTED',shortnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2008,2,5},{17,18,42}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefined},{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2008,2,5},{17,18,42}},crash_report,[[{pid,<0.7.0>},{registered_name,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{application_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller,erl_reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_loader,error_logger,file_server_2,fixtable_server,global_group,global_name_server,heart,init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_server,erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_controller,application_master,application_starter,auth,code,code_aux,packages,code_server,dist_util,erl_boot_server,erl_distribution,erl_prim_loader,erl_reply,erlang,error_handler,error_logger,file,file_server,file_io_server,prim_file,global,global_group,global_search,group,heart,hipe_unified_loader,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet_gethost_native,inet_tcp_dist,init,kernel,kernel_config,net,net_adm,net_kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_server,disk_log_sup,dist_ac,erl_ddll,erl_epmd,erts_debug,gen_tcp,gen_udp,gen_sctp,prim_inet,inet,inet_db,inet_dns,inet_parse,inet_res,inet_tcp,inet_udp,inet_sctp,pg2,seq_trace,wrap_log_reader,zlib,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0>]},{messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,987},{stack_size,21},{reductions,2063}],[]]} {apply,{application,start_boot,[stdlib,permanent]}} {error_logger,{{2008,2,5},{17,18,42}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"} Crash dump was written to: erl_crash.dump Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}) =========== After a little bit of investigation I've noticed, that there is no '{reuseaddr, true}' socket option in the lib/kernel/src/inet_tcp_dist.erl. If I add this option, recompile inet_tcp_dist.erl, put it into proper place, everything works fine like when mentioned above kernel options are omitted. The tiny patch is included. -- Igor Goryachev Yandex development team. -------------- next part -------------- A non-text attachment was scrubbed... Name: inet_tcp_dist.erl_add-reuseaddr.diff Type: text/x-diff Size: 461 bytes Desc: not available URL: From bob@REDACTED Thu Feb 7 23:39:28 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 7 Feb 2008 14:39:28 -0800 Subject: [erlang-bugs] Problem compiling --enable-darwin-64bit on Mac OS X Message-ID: <6a36e7290802071439p73d56bc7x4e482462a95caede@mail.gmail.com> Using the source from otp_src_R12B-1.tar.gz I'm unable to compile a 64-bit Darwin build. $ sw_vers ProductName: Mac OS X ProductVersion: 10.5.1 BuildVersion: 9B18 $ cc --version i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ./configure --enable-darwin-64bit --prefix=/mochi ... $ make ... === Entering application orber make[3]: Nothing to be done for `opt'. make[3]: Nothing to be done for `opt'. CLASSPATH=../.. javac -d ../../priv/ InitialReference.java make -f i386-apple-darwin9.1.0/Makefile TYPE=opt mkdir -p ../priv/obj/i386-apple-darwin9.1.0 mkdir -p ../priv/bin/i386-apple-darwin9.1.0 gcc -c -o ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o -m64 -g -O2 -I/Users/bob/src/otp/otp_src_R12B-1/erts/i386-apple-darwin9.1.0 -no-cpp-precomp -DHAVE_CONFIG_H obj_init_port.c obj_init_port.c: In function 'main': obj_init_port.c:73: warning: incompatible implicit declaration of built-in function 'exit' obj_init_port.c:84: warning: incompatible implicit declaration of built-in function 'exit' obj_init_port.c:101: warning: pointer targets in passing argument 3 of 'accept' differ in signedness obj_init_port.c: In function 'read_request_from_socket': obj_init_port.c:204: warning: incompatible implicit declaration of built-in function 'malloc' obj_init_port.c: In function 'dispatch': obj_init_port.c:238: warning: incompatible implicit declaration of built-in function 'exit' obj_init_port.c: In function 'read_reply': obj_init_port.c:337: warning: incompatible implicit declaration of built-in function 'malloc' obj_init_port.c: In function 'net_init': obj_init_port.c:391: warning: incompatible implicit declaration of built-in function 'exit' gcc -c -o ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o -m64 -g -O2 -I/Users/bob/src/otp/otp_src_R12B-1/erts/i386-apple-darwin9.1.0 -no-cpp-precomp -DHAVE_CONFIG_H setsockaddr_in.c setsockaddr_in.c: In function 'setsockaddr_in': setsockaddr_in.c:45: warning: incompatible implicit declaration of built-in function 'bzero' setsockaddr_in.c:50: warning: large integer implicitly truncated to unsigned type setsockaddr_in.c:61: warning: incompatible implicit declaration of built-in function 'bcopy' gcc -o ../priv/bin/i386-apple-darwin9.1.0/obj_init_port ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o -lutil -ldl -lm ld: warning in ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o, file is not of required architecture ld: warning in ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o, file is not of required architecture Undefined symbols: "_main", referenced from: start in crt1.10.5.o ld: symbol(s) not found collect2: ld returned 1 exit status make[4]: *** [../priv/bin/i386-apple-darwin9.1.0/obj_init_port] Error 1 make[3]: *** [opt] Error 2 make[2]: *** [opt] Error 2 make[1]: *** [opt] Error 2 make: *** [libs] Error 2 -bob From bob@REDACTED Fri Feb 8 00:22:39 2008 From: bob@REDACTED (Bob Ippolito) Date: Thu, 7 Feb 2008 15:22:39 -0800 Subject: [erlang-bugs] Problem compiling otp_src_R12B-1 on FreeBSD 6.2-RELEASE-p3 Message-ID: <6a36e7290802071522p4ea1a516k413e4edd579ae4a0@mail.gmail.com> $ ./configure --enable-hipe --enable-smp --enable-threads --prefix=/mochi ... $ gmake ... === Entering application erl_interface gmake[3]: Entering directory `/usr/home/mochi/bld/otp_src_R12B-1/lib/erl_interface/src' gmake -f i386-unknown-freebsd6.2/Makefile TYPE=opt gmake[4]: Entering directory `/usr/home/mochi/bld/otp_src_R12B-1/lib/erl_interface/src' gcc -g -O2 -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -fno-strict-aliasing -I. -I../include -Iconnect -Iencode -Idecode -Imisc -Iepmd -Iregistry -Ii386-unknown-freebsd6.2 -D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS -c connect/ei_resolve.c -o /home/mochi/bld/otp_src_R12B-1/lib/erl_interface/obj.mt/i386-unknown-freebsd6.2/ei_resolve.o connect/ei_resolve.c: In function `ei_gethostbyname_r': connect/ei_resolve.c:625: warning: passing arg 5 of `gethostbyname_r' from incompatible pointer type connect/ei_resolve.c:625: error: too few arguments to function `gethostbyname_r' connect/ei_resolve.c:625: warning: return makes pointer from integer without a cast gmake[4]: *** [/home/mochi/bld/otp_src_R12B-1/lib/erl_interface/obj.mt/i386-unknown-freebsd6.2/ei_resolve.o] Error 1 gmake[4]: Leaving directory `/usr/home/mochi/bld/otp_src_R12B-1/lib/erl_interface/src' gmake[3]: *** [opt] Error 2 gmake[3]: Leaving directory `/usr/home/mochi/bld/otp_src_R12B-1/lib/erl_interface/src' gmake[2]: *** [opt] Error 2 gmake[2]: Leaving directory `/usr/home/mochi/bld/otp_src_R12B-1/lib/erl_interface' gmake[1]: *** [opt] Error 2 gmake[1]: Leaving directory gmake: *** [libs] Error 2 -bob From bob@REDACTED Fri Feb 8 20:24:59 2008 From: bob@REDACTED (Bob Ippolito) Date: Fri, 8 Feb 2008 11:24:59 -0800 Subject: [erlang-bugs] Problem compiling --enable-darwin-64bit on Mac OS X In-Reply-To: <6a36e7290802071439p73d56bc7x4e482462a95caede@mail.gmail.com> References: <6a36e7290802071439p73d56bc7x4e482462a95caede@mail.gmail.com> Message-ID: <6a36e7290802081124h7687505cy12a544918a28c8dd@mail.gmail.com> I received this information about building 64-bit on Mac OS X from Ian P. Cardenas: I got everything to build using ./configure --enable-smp-support --enable-hipe --enable-darwin-64bit --with-gd=/usr/local --enable-kernel-poll Problems I had: orber has an 'file is not of required architecture' bug workaround: add $(ALL_CFLAGS) in lib/orber/c_src/i386-apple-darwin9.1.0/Makefile for target that includes obj_init_port odbc doesn't build unless you include --enable-darwin-64bit --with-gd doesn't produce a valid flag in the makefile for percept workaround: edit GD_LIBDIR = -L/usr/local/lib in lib/percept/c_src/i386-apple-darwin9.1.0/Makefile Now if only I could get the hipe patch to work :P Thanks, Ian On Feb 7, 2008 2:39 PM, Bob Ippolito wrote: > Using the source from otp_src_R12B-1.tar.gz I'm unable to compile a > 64-bit Darwin build. > > $ sw_vers > ProductName: Mac OS X > ProductVersion: 10.5.1 > BuildVersion: 9B18 > $ cc --version > i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) > Copyright (C) 2005 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > $ ./configure --enable-darwin-64bit --prefix=/mochi > ... > $ make > ... > === Entering application orber > make[3]: Nothing to be done for `opt'. > make[3]: Nothing to be done for `opt'. > CLASSPATH=../.. javac -d ../../priv/ InitialReference.java > make -f i386-apple-darwin9.1.0/Makefile TYPE=opt > mkdir -p ../priv/obj/i386-apple-darwin9.1.0 > mkdir -p ../priv/bin/i386-apple-darwin9.1.0 > gcc -c -o ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o -m64 -g > -O2 -I/Users/bob/src/otp/otp_src_R12B-1/erts/i386-apple-darwin9.1.0 > -no-cpp-precomp -DHAVE_CONFIG_H obj_init_port.c > obj_init_port.c: In function 'main': > obj_init_port.c:73: warning: incompatible implicit declaration of > built-in function 'exit' > obj_init_port.c:84: warning: incompatible implicit declaration of > built-in function 'exit' > obj_init_port.c:101: warning: pointer targets in passing argument 3 of > 'accept' differ in signedness > obj_init_port.c: In function 'read_request_from_socket': > obj_init_port.c:204: warning: incompatible implicit declaration of > built-in function 'malloc' > obj_init_port.c: In function 'dispatch': > obj_init_port.c:238: warning: incompatible implicit declaration of > built-in function 'exit' > obj_init_port.c: In function 'read_reply': > obj_init_port.c:337: warning: incompatible implicit declaration of > built-in function 'malloc' > obj_init_port.c: In function 'net_init': > obj_init_port.c:391: warning: incompatible implicit declaration of > built-in function 'exit' > gcc -c -o ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o -m64 -g > -O2 -I/Users/bob/src/otp/otp_src_R12B-1/erts/i386-apple-darwin9.1.0 > -no-cpp-precomp -DHAVE_CONFIG_H setsockaddr_in.c > setsockaddr_in.c: In function 'setsockaddr_in': > setsockaddr_in.c:45: warning: incompatible implicit declaration of > built-in function 'bzero' > setsockaddr_in.c:50: warning: large integer implicitly truncated to > unsigned type > setsockaddr_in.c:61: warning: incompatible implicit declaration of > built-in function 'bcopy' > gcc -o ../priv/bin/i386-apple-darwin9.1.0/obj_init_port > ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o > ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o -lutil -ldl -lm > ld: warning in ../priv/obj/i386-apple-darwin9.1.0/obj_init_port.o, > file is not of required architecture > ld: warning in ../priv/obj/i386-apple-darwin9.1.0/setsockaddr_in.o, > file is not of required architecture > Undefined symbols: > "_main", referenced from: > start in crt1.10.5.o > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[4]: *** [../priv/bin/i386-apple-darwin9.1.0/obj_init_port] Error 1 > make[3]: *** [opt] Error 2 > make[2]: *** [opt] Error 2 > make[1]: *** [opt] Error 2 > make: *** [libs] Error 2 > > -bob > From saleyn@REDACTED Sun Feb 10 16:46:57 2008 From: saleyn@REDACTED (Serge Aleynikov) Date: Sun, 10 Feb 2008 10:46:57 -0500 Subject: [erlang-bugs] Bug in snmp_generic.erl Message-ID: <47AF1C71.1070704@gmail.com> It appears to be present in all recent versions. Serge --- lib/snmp/src/agent/snmp_generic.erl.orig 2008-02-10 10:25:47.981319000 -0500 +++ lib/snmp/src/agent/snmp_generic.erl 2008-02-10 10:26:31.884368000 -0500 @@ -595,10 +595,10 @@ table_set_cols(NameDb, RowIndex, [{Col, Val} | Cols]) -> case catch table_set_element(NameDb, RowIndex, Col, Val) of true -> table_set_cols(NameDb, RowIndex, Cols); - _X -> + X -> user_err("snmp_generic:table_set_cols set ~w to" " ~w returned ~w", - [{NameDb, RowIndex}, {Col, Val}]), + [{NameDb, RowIndex}, {Col, Val}, X]), {undoFailed, Col} end. From fritchie@REDACTED Sun Feb 10 23:16:50 2008 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Sun, 10 Feb 2008 16:16:50 -0600 Subject: [erlang-bugs] seq_trace broken for a while? Message-ID: <86087.1202681810@snookles.snookles.com> Greetings ... I haven't used seq_trace enough to know if it has ever been in a not-broken state, but it seems to be broken in both R11B-5 and R12B-1. In the attached piece of doodling, tracefoo:demo5() and tracefoo:demo1() give a couple of examples of what's going on. (The other demo* functions are attempts to find a pattern in the haystack.) In demo5(), I was expecting a 'send' and 'receive' trace msgs for the 1st & 3rd hops in the message's 3-hop page. In demo1(), I was expecting to see 'send' and 'receive' trace msgs for each of the round-trip messages. Any chance I'm not understanding the 'seq_trace' reference manual? -Scott --- snip --- snip --- snip --- snip --- snip --- -module(tracefoo). -compile(export_all). setup() -> seq_trace:set_token(send,true), seq_trace:set_token('receive',true), seq_trace:set_token(timestamp, true), seq_trace:set_token(print,true), ok. little_child() -> receive {big_parent, Pid} -> Pid ! {little_child_reply, from, self()} end. %% %% R11B-5 and R12B-1: %% No send or receive seq_trace messages on 1st & 3rd message hops! %% But all print seq_trace messages are printed as expected. %% Seq_trace messages related to the io:format() are all (?) present? %% demo5() -> ServerA = spawn(fun server/0), ServerB = spawn(fun server/0), seq_trace:set_system_tracer(self()), timer:sleep(300), % no effect... setup(), timer:sleep(300), % no effect... Token = seq_trace:get_token(), erlang:display({token_is, Token}), ServerA ! {forward_to, ServerB, {big_parent, self()}}, timer:sleep(300), receive X when element(1, X) == little_child_reply -> seq_trace:print({i, am, self(), got, my, ultimate, reply}), io:format("Got X = ~p\n", [X]) end, timer:sleep(300), seq_trace:set_system_tracer(false), shell_default:flush(). %% %% R11B-5 and R12B-1: %% No send or receive seq_trace messages received at all! %% demo1() -> spawn(fun() -> seq_trace:set_system_tracer(self()), setup(), timer:sleep(300), % No effect... C1 = spawn(fun little_child/0), C2 = spawn(fun little_child/0), C1 ! {big_parent, self()}, C2 ! {big_parent, self()}, timer:sleep(300), seq_trace:set_system_tracer(false), shell_default:flush() end), timer:sleep(2*1000). %% Variations on the theme.... demo2() -> seq_trace:set_system_tracer(self()), spawn(fun() -> setup(), C1 = spawn(fun little_child/0), C2 = spawn(fun little_child/0), C1 ! {big_parent, self()}, C2 ! {big_parent, self()}, timer:sleep(1*1000), ok end), timer:sleep(2*1000), seq_trace:set_system_tracer(false), shell_default:flush(). demo3() -> seq_trace:set_system_tracer(self()), setup(), spawn(fun() -> C1 = spawn(fun little_child/0), C2 = spawn(fun little_child/0), C1 ! {big_parent, self()}, C2 ! {big_parent, self()}, timer:sleep(1*1000), ok end), timer:sleep(2*1000), seq_trace:set_system_tracer(false), shell_default:flush(). demo4() -> seq_trace:set_system_tracer(self()), setup(), spawn(fun() -> setup(), C1 = spawn(fun little_child/0), C2 = spawn(fun little_child/0), timer:sleep(100), setup(), C1 ! {big_parent, self()}, C2 ! {big_parent, self()}, seq_trace:set_token(label, 77), timer:sleep(1*1000), ok end), timer:sleep(2*1000), seq_trace:set_system_tracer(false), shell_default:flush(). server() -> receive {forward_to, NewPid, Msg} -> seq_trace:print({i, am, self(), forwarding, to, NewPid}), NewPid ! Msg; {big_parent, Pid} -> seq_trace:print({i, am, self(), replying, to, Pid}), Pid ! {little_child_reply, from, self()} end. demo6() -> seq_trace:set_system_tracer(self()), setup(), ServerA = spawn(fun server/0), ServerB = spawn(fun server/0), ServerA ! {forward_to, ServerB, {big_parent, self()}}, timer:sleep(100), seq_trace:set_system_tracer(false), shell_default:flush(). From kenneth.lundin@REDACTED Mon Feb 11 11:12:50 2008 From: kenneth.lundin@REDACTED (Kenneth Lundin) Date: Mon, 11 Feb 2008 11:12:50 +0100 Subject: [erlang-bugs] seq_trace broken for a while? In-Reply-To: <86087.1202681810@snookles.snookles.com> References: <86087.1202681810@snookles.snookles.com> Message-ID: On Feb 10, 2008 11:16 PM, Scott Lystig Fritchie wrote: > Greetings ... I haven't used seq_trace enough to know if it has ever > been in a not-broken state, but it seems to be broken in both R11B-5 and > R12B-1. seq_trace is not broken at all. I have run your test program and have explanations for why it does not work as YOU expect. In demo5, demo2, demo4 you are relying on the shell process as the system tracer and expect all trace messages to be left in the message queue when you call shell_default:flush(). This is not safe, there are many messages exchanged to and from the shell and it seems as if some of the trace messages are discarded from the message queue while waiting for io-related messages. In demo1 you are spawning a new process and setting that process to the system_tracer. The problem is that the process set to be system tracer also is involved in the tracing (sending and receiving messages to be traced) , this does not work since it would cause infinite loops if the system tracer it self is part of the tracing. In demo3 the setup function including the set_token calls is done in a different function from the one initiating the messages to be traced. This means that the tracing is not activated and nothing will be traced. The way to solve this and make the sequential tracing work as expected is to spawn a separate tracer process which is set as the system tracer. One example to do this is like this: tracer() -> receive {seq_trace,Label,TraceInfo} -> print_trace(Label,TraceInfo,false); {seq_trace,Label,TraceInfo,Ts} -> print_trace(Label,TraceInfo,Ts); Other -> ignore end, tracer(). print_trace(Label,TraceInfo,false) -> io:format("~p:",[Label]), print_trace(TraceInfo); print_trace(Label,TraceInfo,Ts) -> io:format("~p ~p:",[Label,Ts]), print_trace(TraceInfo). print_trace({print,Serial,From,_,Info}) -> io:format("~p Info ~p WITH~n~p~n", [From,Serial,Info]); print_trace({'receive',Serial,From,To,Message}) -> io:format("~p Received ~p FROM ~p WITH~n~p~n", [To,Serial,From,Message]); print_trace({send,Serial,From,To,Message}) -> io:format("~p Sent ~p TO ~p WITH~n~p~n", [From,Serial,To,Message]). init_tracer() -> Pid = spawn(?MODULE,tracer,[]), seq_trace:set_system_tracer(Pid), Pid. stop_tracer(Pid) -> seq_trace:set_system_tracer(false), exit(Pid,kill). Use the init_tracer and stop_tracer instead of set_system_tracer(self()). /Regards Kenneth > In the attached piece of doodling, tracefoo:demo5() and tracefoo:demo1() > give a couple of examples of what's going on. (The other demo* > functions are attempts to find a pattern in the haystack.) > > In demo5(), I was expecting a 'send' and 'receive' trace msgs for the > 1st & 3rd hops in the message's 3-hop page. In demo1(), I was expecting > to see 'send' and 'receive' trace msgs for each of the round-trip > messages. > > Any chance I'm not understanding the 'seq_trace' reference manual? > > -Scott > > --- snip --- snip --- snip --- snip --- snip --- > > -module(tracefoo). > > -compile(export_all). > > setup() -> > seq_trace:set_token(send,true), > seq_trace:set_token('receive',true), > seq_trace:set_token(timestamp, true), > seq_trace:set_token(print,true), > ok. > > little_child() -> > receive {big_parent, Pid} -> > Pid ! {little_child_reply, from, self()} > end. > > %% > %% R11B-5 and R12B-1: > %% No send or receive seq_trace messages on 1st & 3rd message hops! > %% But all print seq_trace messages are printed as expected. > %% Seq_trace messages related to the io:format() are all (?) present? > %% > > demo5() -> > ServerA = spawn(fun server/0), > ServerB = spawn(fun server/0), > seq_trace:set_system_tracer(self()), > timer:sleep(300), % no effect... > setup(), > timer:sleep(300), % no effect... > Token = seq_trace:get_token(), erlang:display({token_is, Token}), > ServerA ! {forward_to, ServerB, {big_parent, self()}}, > timer:sleep(300), > receive X when element(1, X) == little_child_reply -> > seq_trace:print({i, am, self(), got, my, ultimate, reply}), > io:format("Got X = ~p\n", [X]) > end, > timer:sleep(300), > seq_trace:set_system_tracer(false), > shell_default:flush(). > > %% > %% R11B-5 and R12B-1: > %% No send or receive seq_trace messages received at all! > %% > > demo1() -> > spawn(fun() -> > seq_trace:set_system_tracer(self()), > setup(), > timer:sleep(300), % No effect... > C1 = spawn(fun little_child/0), > C2 = spawn(fun little_child/0), > C1 ! {big_parent, self()}, > C2 ! {big_parent, self()}, > timer:sleep(300), > seq_trace:set_system_tracer(false), > shell_default:flush() > end), > timer:sleep(2*1000). > > %% Variations on the theme.... > > demo2() -> > seq_trace:set_system_tracer(self()), > spawn(fun() -> > setup(), > C1 = spawn(fun little_child/0), > C2 = spawn(fun little_child/0), > C1 ! {big_parent, self()}, > C2 ! {big_parent, self()}, > timer:sleep(1*1000), > ok > end), > timer:sleep(2*1000), > seq_trace:set_system_tracer(false), > shell_default:flush(). > > demo3() -> > seq_trace:set_system_tracer(self()), > setup(), > spawn(fun() -> > C1 = spawn(fun little_child/0), > C2 = spawn(fun little_child/0), > C1 ! {big_parent, self()}, > C2 ! {big_parent, self()}, > timer:sleep(1*1000), > ok > end), > timer:sleep(2*1000), > seq_trace:set_system_tracer(false), > shell_default:flush(). > > demo4() -> > seq_trace:set_system_tracer(self()), > setup(), > spawn(fun() -> > setup(), > C1 = spawn(fun little_child/0), > C2 = spawn(fun little_child/0), > timer:sleep(100), > setup(), > C1 ! {big_parent, self()}, > C2 ! {big_parent, self()}, > seq_trace:set_token(label, 77), > timer:sleep(1*1000), > ok > end), > timer:sleep(2*1000), > seq_trace:set_system_tracer(false), > shell_default:flush(). > > server() -> > receive > {forward_to, NewPid, Msg} -> > seq_trace:print({i, am, self(), forwarding, to, NewPid}), > NewPid ! Msg; > {big_parent, Pid} -> > seq_trace:print({i, am, self(), replying, to, Pid}), > Pid ! {little_child_reply, from, self()} > end. > > demo6() -> > seq_trace:set_system_tracer(self()), > setup(), > ServerA = spawn(fun server/0), > ServerB = spawn(fun server/0), > ServerA ! {forward_to, ServerB, {big_parent, self()}}, > timer:sleep(100), > seq_trace:set_system_tracer(false), > shell_default:flush(). > > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-bugs > From bjorn@REDACTED Mon Feb 11 14:08:11 2008 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 11 Feb 2008 14:08:11 +0100 Subject: [erlang-bugs] binary_to_term can crash erl In-Reply-To: References: Message-ID: Thanks! In R12B-2 binary_to_term/1 will cause a badarg exception if there are any atoms longer than 255 characters in the binary. Atoms created in various ways through the driver API will be truncated to 255 characters if necessary. /Bjorn "Matthew Dempsky" writes: > Calling binary_to_term can cause the erl interpreter to crash: > > 1> binary_to_term(iolist_to_binary([<<131, 100, 65000:16>> | > lists:duplicate(65000, 42)])). > > Crash dump was written to: erl_crash.dump > absurdly large atom > Abort trap > > I think binary_to_term should instead just kill the process that > called binary_to_term, similar to calling list_to_atom on a list that > is too large. > > Also, it's possible to create atoms larger than 255 characters this way. > _______________________________________________ > erlang-bugs mailing list > erlang-bugs@REDACTED > http://www.erlang.org/mailman/listinfo/erlang-bugs > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ulf@REDACTED Mon Feb 11 22:44:29 2008 From: ulf@REDACTED (Ulf Wiger) Date: Mon, 11 Feb 2008 22:44:29 +0100 Subject: [erlang-bugs] [erlang-questions] using xmerl on web docs In-Reply-To: <749A41DB-88FE-43D5-A391-4BF41DB8D854@scaldeferri.com> References: <0DABC91E-63AB-4E54-A561-AED32DB2E579@scaldeferri.com> <8209f740802101003s4e1493ci1fde044f1cc2ac98@mail.gmail.com> <749A41DB-88FE-43D5-A391-4BF41DB8D854@scaldeferri.com> Message-ID: <8209f740802111344k166c1d04t1baba447aeb3b876@mail.gmail.com> Hi Kevin, I just thought I'd point out that, while I wrote the original version of xmerl some 8 years ago, I've hardly ever used it since. (: This does seem like a bug in xmerl_scan, though: case DataRet of {file,F} -> {get_file(F,S),F}; {string,Str} -> {binary_to_list(Str),file_name_unknown}; It is obvious that Str should be treated as a string, and calling binary_to_list(Str) is bound to fail. You could, of course, make your code bug-compatible and return {string, list_to_binary(Body)} ;-) BR, Ulf W 2008/2/11, Kevin Scaldeferri : > Hi Ulf, > > Well, I wrote my own fetch, but I'm still having problems with the > XHTML1 DTD (http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd). It > includes a number of other fragments with entity declarations and > such. I had to do some gymnastics in my fetch function to deal with > the relative paths, but now I get this: > > 49> spider:start("http://kevin.scaldeferri.com/"). > fetching http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd > fetching xhtml-lat1.ent > resolved xhtml-lat1.ent to http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent > fetching http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent > ** exception error: bad argument > in function binary_to_list/1 > called as > called as binary_to_list("