From vladdu@REDACTED Mon Jan 1 13:39:14 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Mon, 01 Jan 2001 13:39:14 +0100 Subject: GS and GUIs Message-ID: >In the end the approach we took was to build a >Tcl/Tk extension which links in the erl_interface library. hi, that's interesting, but my TclTk knowledge is next to nil... I'd rather use something else, even if it might not be platform independent. But for practical reasons, it might be easier to learn Tcl :-( /Vlad _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. From vladdu@REDACTED Mon Jan 1 18:14:16 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Mon, 1 Jan 2001 18:14:16 +0100 Subject: GS "output" References: Message-ID: Hi I don't remember if I did ask this before... Is there a way to find out the exact commands GS sends to Tk? tia /Vlad From dne@REDACTED Mon Jan 1 23:17:35 2001 From: dne@REDACTED (Daniel Neri) Date: 01 Jan 2001 23:17:35 +0100 Subject: GS and GUIs In-Reply-To: "Vance Shipley"'s message of "Sun, 31 Dec 2000 15:59:55 -0500" References: Message-ID: <87d7e629z4.fsf@nowhere.mayonnaise.net> "Vance Shipley" writes: > In the end the approach we took was to build a Tcl/Tk extension > which links in the erl_interface library. With this approach the > GUI is built entirely in standard Tcl/Tk and it uses message passing > to interact with the Erlang processes. As I've been thinking along those lines myself, is there any chance of that library of yours getting out in the open? Regards, --Daniel -- Daniel Neri dne@REDACTED From vances@REDACTED Tue Jan 2 04:33:56 2001 From: vances@REDACTED (Vance Shipley) Date: Mon, 1 Jan 2001 22:33:56 -0500 Subject: my debug handler won't stick Message-ID: The sys module has a function to install a custom debug function which will be called whenever a system event is generated. It is defined as: sys:install(Name, Func, FuncState) -> done | NewFuncState So I create a debug function like this: dbg_fun(FuncState, Event, ProcState) -> io:fwrite("~w ~w ~w~n", [FuncState, Event, ProcState]), FuncState. and install it with: sys:install(testing, {test, dbg_fun}, foo) Now the next time I send a message ('bar') to testing I get: foo {in, {'$gen_event', bar}} {testing, state1} Which is great however subsequent messages don't result in dbg_fun getting called. The documentation says: Func is called whenever a system event is generated. This function should return done, or a new func state. In the first case, the function is removed. It is removed if the function fails. I assume that FuncState is used to do things like keep counters, or file names etc. as persistant data through subsequent calls. It is of type term. My read is that it should stay put unless I return 'done'. What am I doing wrong? -Vance From mbj@REDACTED Tue Jan 2 11:03:02 2001 From: mbj@REDACTED (Martin Bjorklund) Date: Tue, 02 Jan 2001 11:03:02 +0100 Subject: my debug handler won't stick In-Reply-To: Your message of "Mon, 1 Jan 2001 22:33:56 -0500" References: Message-ID: <20010102110302O.mbj@bluetail.com> "Vance Shipley" wrote: > > The sys module has a function to install a custom debug > function which will be called whenever a system event is > generated. It is defined as: > > sys:install(Name, Func, FuncState) -> done | NewFuncState > > So I create a debug function like this: > > dbg_fun(FuncState, Event, ProcState) -> > io:fwrite("~w ~w ~w~n", [FuncState, Event, ProcState]), > FuncState. > > and install it with: > > sys:install(testing, {test, dbg_fun}, foo) You probaly mean: sys:install(testing, {{test, dbg_fun}, foo}) > Now the next time I send a message ('bar') to testing I get: > > foo {in, {'$gen_event', bar}} {testing, state1} > > Which is great however subsequent messages don't result in > dbg_fun getting called. You can check the status of you process by calling sys:get_status/1. There you'll see if your handler is installed: 2> sys:install(error_logger, {{test, dbg_fun}, foo}). ok 3> sys:get_status(error_logger). {status,<0.4.0>, {module,gen_event}, [[{'$ancestors',[<0.1.0>]}, {'$initial_call',{gen,init_it, [gen_event, <0.1.0>, <0.1.0>, {local,error_logger}, [], [], []]}}], running, <0.1.0>, [{{test,dbg_fun},foo}], <----------------- [error_logger, [{handler,error_logger,false,[],false}, {handler,error_logger_tty_h,false,{<0.18.0>,error_logger},false}]]]} This works fine for me. /martin From etxuwig@REDACTED Tue Jan 2 12:16:48 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 2 Jan 2001 12:16:48 +0100 (MET) Subject: Basic Mnesia Distribution Questions In-Reply-To: <402DD461F109D411977E0008C791C3125654E0@imp02mbx.one2one.co.uk> Message-ID: On Thu, 28 Dec 2000, Sean Hinde wrote: >I'm not aware that this problem has been solved for any available >replicated database system like mnesia but if anyone knows better >maybe they can share.. > >Solving this properly in the general case is utterly mind bending, >but I have wondered whether one could come up with some scheme which >logged updates/deletes locally and attempted to merge these by >calling a user defined callback for each explicitly defined >transaction/update type.. Thoughts? I believe this is considered a pathological problem, i.e. there is no general solution -- only application-specific ones. An example: Basically all networked PIMs (Personal Information Managers) have to address this problem somehow, since we do not yet live in the "always connected" world. If you have your agenda available on the LAN, but want to be able to modify it while on the road, the PIM will have to resynchronize the appointments. In the ones I've tried, this procedure is semi-automatic at best: if an appointment has been modified both in the network copy and on your laptop, the PIM will usually ask which one you want to keep; in all other cases, synchronization can automatic. Obviously, this does not work in an unattended embedded system. Here, the dilemma is that you have to automatically restore the system, but this almost always means possibly losing some updates. A common method is to look at the roles of each node (basically, what applications are running on each), and making some sort of guess at which node has the most "interesting" copy of the database. An additional problem is that the situation is easily compounded as the nodes re-connect, so while some control component is trying to figure out which node(s) to restart, new (possibly irreparable) inconsistencies may appear. One solution to this problem is to forbid nodes to re-connect, and resolve the inconsistency off-line. This can be done with the kernel environment variable 'dist_auto_connect' (in OTP R7B), which allows you to turn off the auto-connect characteristic that is default in distributed Erlang. Example: erl -kernel dist_auto_connect once will allow erlang nodes to connect automatically _the first time_, which is normally when an erlang node starts, and pings an running node. If the connection is lost and then restored, the nodes will not automatically re-connect. Using a backdoor, e.g. a UDP ping, a control component may detect the situation and decide what to do without risking further damage to the system. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From Sean.Hinde@REDACTED Tue Jan 2 13:09:01 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 2 Jan 2001 12:09:01 -0000 Subject: multi-attribute mnesia indexes? Message-ID: <402DD461F109D411977E0008C791C3125654E6@imp02mbx.one2one.co.uk> Shawn, See comments below: > We're working on an application that probably should be using Oracle. > However, the dataset is small enough that we should be able to use > mnesia (100,000 rows in a table). What we have run into is that we > want to have 16 or so processes scanning the mnesia table, > while another > two are performing write transactions against it. > > First problem is that Mnesia is reporting its overloaded. The exact > console message is: > > =ERROR REPORT==== 28-Dec-2000::23:55:46 === > Mnesia('spearce@REDACTED'): ** ERROR > ** Mnesia is overloaded: {dump_log, time_threshold} Updates to disc copies tables append to a logfile which is periodically scanned and propogated into the main disc based database tables. This error message can occur when the log has not finished dumping by the time the next periodic or threshold based dump needs to start. This is not too serious if it is a temporary overload situation as mnesia will catch up (assuming you haven't filled the disc!) In your case it sounds like you are pushing in more than mnesia can handle on a continuous basis? > I dug in the archives and added these to my command line: > > -mnesia dump_log_load_regulation false \ > -mnesia dump_log_write_threshold 100000 \ > > This cut back on the number of Mnesia error reports to one every few > minutes, but they are still occuring. dump_log_load_regulation is set to false by default so this isn't changing anything here (false is the correct setting for max speed). All you are doing is letting the log file get bigger before dumping - no particular advantage > What the appliation is doing is, two generator processes are writing > records into two mnesia tables, some 100,000 records at once. Both > processes are running in a tight loop, kind of like what you > see below: > > mk(0) -> done; > mk(X) -> > A = #foo{...}, > B = #bar{...}, > mnesia:transaction(fun() -> > mnesia:write(A), > mnesia:write(B) > end), > mk(X - 1). > > I started them by hand from the shell with: > > spawn(mymod, mk, [50000]). > spawn(mymod, mk, [50000]). > > Rough calculation shows that mnesia is only doing 43 of these > transactions per second with the system load such that it is. > > Now to add to the confusion, 16 other processes are running > dirty_match_object operations against the tables at the same time the > two generators are writing to them. One of the 16 processes > reads only > one column in an index, so we use dirty_index_read. The other 15 are > busy with calls (many calls) to dirty_match_object. The pattern used > is the wild pattern for the table (9 attributes), with 5 of the > attributes filled in with a value. The other 4 were left alone. (To > be wild cards.) None of these was the primary key (first attribute). > > Erlang uses 99% of the CPU to run this job. Right now, its > up at 70 MB > of RAM, as the tables are all disk_copies tables (so they are cached > in RAM). Would switchig to disk_only tables help performance, getting > rid of the cruft from RAM faster? My machine has 256 MB of RAM free, > so swapping is not occuring at the OS level. > > So..... > > 1) What can I do differently to prevent mnesia from whining about its > log files? If you are using standard Unix File System changing to a more modern one would help significantly. You could subscribe to mnesia overload messages and slow down your writing process if you recieve any. If your write is a one off you could just forget about the overload messages and ensure you have enough disc space to hold the largest log file.. > 2) Is there anything I can do to increase the performance of my match > operation? Would switching to mnemosyne help in this sitution? Does > mnesia support multi-attribute indexes which would speed up the > performance of the match_object operation? mnesia supports multi column indexes. Have a look at the docs for mnesia:add_table_index/2. The function mnesia:index_match_obect will make use of one explicitly named index where this is a bound variable in the match tuple > > At present, my only other option is to switch to a real SQL database, > as I can get true multi-column indexes there. I'd stick with the real mnesia database for a bit longer! > -- > Shawn. - Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Tue Jan 2 13:58:09 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 2 Jan 2001 13:58:09 +0100 (MET) Subject: multi-attribute mnesia indexes? In-Reply-To: <20001229001718.G18405@spearce.org> Message-ID: On Fri, 29 Dec 2000, Shawn Pearce wrote: >We're working on an application that probably should be using >Oracle. However, the dataset is small enough that we should be able >to use mnesia (100,000 rows in a table). What we have run into is >that we want to have 16 or so processes scanning the mnesia table, >while another two are performing write transactions against it. One thing about mnesia is that it's not really prepared for applications that write constantly to disk-based tables. >First problem is that Mnesia is reporting its overloaded. The exact >console message is: > > =ERROR REPORT==== 28-Dec-2000::23:55:46 === > Mnesia('spearce@REDACTED'): ** ERROR ** Mnesia is overloaded: {dump_log, time_threshold} > >I dug in the archives and added these to my command line: > > -mnesia dump_log_load_regulation false \ > -mnesia dump_log_write_threshold 100000 \ > >This cut back on the number of Mnesia error reports to one every few >minutes, but they are still occuring. > >What the appliation is doing is, two generator processes are writing >records into two mnesia tables, some 100,000 records at once. Both >processes are running in a tight loop, kind of like what you see >below: You seem to understand the nature of mnesia's transaction logging, so I won't go into that, but... Depending on the speed of your file system, you might run into a situation where mnesia simply can't keep up with your writer process. One solution, which would have to be implemented in mnesia, is to make updates completely synchronous. We at AXD 301 have asked for this, as we would like the processes in our system to pay the cost up-front for updating disk tables. Currently, you can easily write a program that gives mnesia serious headaches, due to the asynchronous nature of mnesia:transaction/1. >Rough calculation shows that mnesia is only doing 43 of these >transactions per second with the system load such that it is. > >Now to add to the confusion, 16 other processes are running >dirty_match_object operations against the tables at the same time the >two generators are writing to them. One of the 16 processes reads only >one column in an index, so we use dirty_index_read. The other 15 are >busy with calls (many calls) to dirty_match_object. The pattern used >is the wild pattern for the table (9 attributes), with 5 of the >attributes filled in with a value. The other 4 were left alone. (To >be wild cards.) None of these was the primary key (first attribute). > >Erlang uses 99% of the CPU to run this job. Right now, its up at 70 MB >of RAM, as the tables are all disk_copies tables (so they are cached >in RAM). Would switchig to disk_only tables help performance, getting >rid of the cruft from RAM faster? My machine has 256 MB of RAM free, >so swapping is not occuring at the OS level. If you're calling dirty_match_object/2 with a wildcard pattern on the primary key, and a table with 100000 objects, the function will to a full scan every time. This goes for disc_only tables as well, but the match will be much slower. You will see different characteristics, as a dets-based match will use many more reductions, and the process will yield more often. >So..... > >1) What can I do differently to prevent mnesia from whining about >its log files? I don't know. One drastic measure might be to wrap the call to mnesia:transaction/1 thus: transaction(Fun) -> case mnesia:transaction(Fun) of {atomic, Result} -> mnesia:dump_log(), {atomic, Result}; Other -> Other end. (I've never tried it myself.) >2) Is there anything I can do to increase the performance of my >match operation? Would switching to mnemosyne help in this >sitution? Does mnesia support multi-attribute indexes which would >speed up the performance of the match_object operation? Mnemosyne should be able to make clever use of indexing, but I don't know if it would improve your application's performance. The rdbms-1.4 user contrib supports compound attributes, and also has a select() function (no relation to SQL SELECT). However, the select() function doesn't take into account that parts of a compound attribute may be indexed, and rdbms also doesn't allow indexing of compound attributes (I grew weary trying to figure out how to do this elegantly.) Personally, I'd like to have a way to built derived index tables in mnesia (or rdbms), where one could specify a fun(Object) -> IndexValue to be called by mnesia). So many ideas -- so little time... /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From Sean.Hinde@REDACTED Tue Jan 2 14:30:25 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 2 Jan 2001 13:30:25 -0000 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) Message-ID: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> > One thing about mnesia is that it's not really prepared for > applications that write constantly to disk-based tables. It is not optimal I agree. There are some relatively simple things which could be done to improve this though. One simple idea would be to have independently specified paths to the various log and dets files. Certainly having the log file on its own disk could substantially increase performance of the dumper. Files could also be striped across multiple disks using RAID type systems. Another more complex enhancement would be to treat the log file as a simple recovery log and use a memory based store as the actual source for data to be propogated into the dets files. This could even just contain a list of keys which have been updated in each transaction and the dumper could get the data from the main memory table (with some extra stuff for detection of multiple updates of the same record. Hmmm). Or there could be a separate UNIX thread which runs through the log and does the propogation into the main dets files. I'm sure there are many things which can be done - though splitting out the path of the different files could perhaps be the simplest and most effective (allowing one to throw more hardware bandwidth at the problem). - Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From Dirk.Johannes.Kocian@REDACTED Tue Jan 2 16:03:44 2001 From: Dirk.Johannes.Kocian@REDACTED (Dirk Johannes Kocian) Date: Tue, 02 Jan 2001 16:03:44 +0100 Subject: Erlang-Node Message-ID: <3A51EDD0.EC4CF358@eto.ericsson.se> Hi! What is an Erlang-Node? /Dirk From Sean.Hinde@REDACTED Tue Jan 2 16:21:23 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 2 Jan 2001 15:21:23 -0000 Subject: Erlang-Node Message-ID: <402DD461F109D411977E0008C791C3125654F3@imp02mbx.one2one.co.uk> > What is an Erlang-Node? In short, it is a running instance of Erlang. I guess the reason for the name "Node" is that Erlang is often used in its distributed mode (started with e.g. erl -sname dirk). One can then have a Network of Erlang Nodes. Node being a networky sort of name :-) - Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From spearce@REDACTED Tue Jan 2 21:49:16 2001 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 2 Jan 2001 15:49:16 -0500 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk>; from Sean.Hinde@one2one.co.uk on Tue, Jan 02, 2001 at 01:30:25PM -0000 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> Message-ID: <20010102154916.B26255@spearce.org> Sean Hinde scrawled: > > One thing about mnesia is that it's not really prepared for > > applications that write constantly to disk-based tables. > > It is not optimal I agree. There are some relatively simple things which > could be done to improve this though. > > One simple idea would be to have independently specified paths to the > various log and dets files. Certainly having the log file on its own disk > could substantially increase performance of the dumper. Oracle does this with their database and it is a big performance booster. The other thing they do is allow a table to be striped across multiple disks by making a table exist in multiple file system files at once. (They stripe disk allocations across the files.) This does help to manage larger tables as well. > Files could also be striped across multiple disks using RAID type systems. We don't have a RAID system on this machine yet, but your correct, we really should be working with RAID if we're really serious. (Which we aren't yet, we're still in development, I had just hoped for better performance before RAID was added, as IMHO, a good RAID array only adds so much before it too becomes a bottleneck.) > Another more complex enhancement would be to treat the log file as a simple > recovery log and use a memory based store as the actual source for data to > be propogated into the dets files. This could even just contain a list of > keys which have been updated in each transaction and the dumper could get > the data from the main memory table (with some extra stuff for detection of > multiple updates of the same record. Hmmm). Again, Oracle does this. They identify a single record by its physical disk position (and never, ever move the record). They can then make their log merely a redo log (indeed that is the name). By making the changes to the data table in memory, and writing them to disk in bulk, without needing to execute the log file against the table's data file(s), it saves time later on. I for one would like to be able to force my transactions (write that is) to wait for the log writer to finish writing them if the problem is that mnesia will overload like this. Should I step up the frequency of my log writer in order to force it to write more frequently, and hopefully at least simulate that the writes are waiting for the log? -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From ak@REDACTED Tue Jan 2 22:05:56 2001 From: ak@REDACTED (Andi Kleen) Date: Tue, 2 Jan 2001 22:05:56 +0100 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010102154916.B26255@spearce.org>; from spearce@spearce.org on Tue, Jan 02, 2001 at 03:49:16PM -0500 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> Message-ID: <20010102220556.A18449@gruyere.muc.suse.de> On Tue, Jan 02, 2001 at 03:49:16PM -0500, Shawn Pearce wrote: > Oracle does this with their database and it is a big performance > booster. The other thing they do is allow a table to be striped > across multiple disks by making a table exist in multiple file system > files at once. (They stripe disk allocations across the files.) This > does help to manage larger tables as well. Near all modern OS can do that themselves using volume managers and software RAID -- it would probably be a waste of time to implement it in Mnesia too. -Andi From Sean.Hinde@REDACTED Tue Jan 2 22:31:26 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 2 Jan 2001 21:31:26 -0000 Subject: Mnesia disk performance (was RE: multi-attribute mnesia index es?) Message-ID: <402DD461F109D411977E0008C791C3125654FF@imp02mbx.one2one.co.uk> Shawn, > Oracle does this with their database and it is a big performance > booster. The other thing they do is allow a table to be striped > across multiple disks by making a table exist in multiple file system > files at once. (They stripe disk allocations across the files.) This > does help to manage larger tables as well. Mnesia has fragmented tables which, if the directory of each table fragment could be specified separately, could give much the same gains. > They identify a single record by > its physical > disk position (and never, ever move the record). This does not fit very well with mnesia as the size of entries can vary with each write (with the obvious problem if they get bigger). Dets can't match the performance of this Oracle method directly.. but with some help from the RAM copy table (perhaps holding the disk address with each record) maybe it could get closer. > I for one would like to be able to force my transactions > (write that is) > to wait for the log writer to finish writing them if the > problem is that > mnesia will overload like this. Should I step up the frequency of my > log writer in order to force it to write more frequently, and > hopefully > at least simulate that the writes are waiting for the log? As I understand it, Oracle does much the same thing as mnesia. All it does on a commit is write to the redo log and mark the record as dirty in the SGA. The DB_WRITER processes propogate the updated records from shared memory into disk asynchronously sometime later. One can have multiple DB_WRITERs (maybe running on different processors) to make it faster but the idea is much the same. The same overload problem with Oracle would manifest itself if this propogation into the main disk tables couldn't keep up, and the SGA shared memory segment filled. Oracle is just much faster as a result of its use of memory as the "log", its very strong ability to take advantage of SMP and disk arrays, and some very nice design. I agree though - given the current limitations it would be nice to have some synchronous write ability for ram_copies tables. Just stepping up the frequency of the log writer won't really help. The only thing I have found helps is using a Journaling File System (I use Veritas with pretty stunning results - 3 time faster) but many new Linux releases come with open source versions these days. - Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From spearce@REDACTED Tue Jan 2 22:54:31 2001 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 2 Jan 2001 16:54:31 -0500 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010102220556.A18449@gruyere.muc.suse.de>; from ak@suse.de on Tue, Jan 02, 2001 at 10:05:56PM +0100 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> <20010102220556.A18449@gruyere.muc.suse.de> Message-ID: <20010102165431.D26255@spearce.org> Andi Kleen scrawled: > On Tue, Jan 02, 2001 at 03:49:16PM -0500, Shawn Pearce wrote: > > Oracle does this with their database and it is a big performance > > booster. The other thing they do is allow a table to be striped > > across multiple disks by making a table exist in multiple file system > > files at once. (They stripe disk allocations across the files.) This > > does help to manage larger tables as well. > > Near all modern OS can do that themselves using volume managers and software > RAID -- it would probably be a waste of time to implement it in Mnesia too. This is true, and I agree. However, it does allow Oracle to easily handle >2GB datafiles on Unixes that cannot deal with it. It also lets you stick to 32 bit file offsets by adding a file number ``prefix''. Keep in mind its nice to be able to split backups onto tapes by designing the database datafiles such that one data file fits onto a tape. Or a cluster of datafiles fits onto a tape. What if we have a 100GB database, how do we dump it onto 20GB tapes?? If its one huge file, its harder to dump than if its a collection of 10GB files. Or 1GB files that can be put on tape at 20 (or 19) files at a time. But striping may be out of the question. Maybe its just a linear joining? Anyway, just a thought on top of my other comments with Mnesia. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From info@REDACTED Wed Jan 3 00:55:43 2001 From: info@REDACTED (info@REDACTED) Date: Wed, 3 Jan 2001 00:55:43 +0100 (CET) Subject: Yr Site http://www.erlang.org/ on Search Beglium Message-ID: <200101022355.f02Nth335812@hades.cslab.ericsson.net> An HTML attachment was scrubbed... URL: From spearce@REDACTED Wed Jan 3 04:30:24 2001 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 2 Jan 2001 22:30:24 -0500 Subject: Formatting style? Message-ID: <20010102223024.E26255@spearce.org> Hey, I'm just curious, how do the ``expert'' Erlang programmers format this code: trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> Seller = Market:bid_agent_id(Bid), Id = make_trade(Agent, Seller, Market, Bid), io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), agent:send(Seller, {trade, buy, Id}); trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) -> Buyer = Market:bid_agent_id(Bid), Id = make_trade(Buyer, Agent, Market, Bid), io:format("Agent ~p sell in ~p~n", [agent:id(Agent), Id]), agent:send(Buyer, {trade, sell, Id}). I find it difficult to read that they are the same function, just different varients of trade_with_agent/4. I'm just talking about white space and formatting conventions, however comments about the function's arguments are certainly welcome as well. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From etxuwig@REDACTED Wed Jan 3 10:08:25 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 3 Jan 2001 10:08:25 +0100 (MET) Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010102165431.D26255@spearce.org> Message-ID: On Tue, 2 Jan 2001, Shawn Pearce wrote: >Andi Kleen scrawled: >> On Tue, Jan 02, 2001 at 03:49:16PM -0500, Shawn Pearce wrote: >> > Oracle does this with their database and it is a big performance >> > booster. The other thing they do is allow a table to be striped >> > across multiple disks by making a table exist in multiple file system >> > files at once. (They stripe disk allocations across the files.) This >> > does help to manage larger tables as well. >> >> Near all modern OS can do that themselves using volume managers and software >> RAID -- it would probably be a waste of time to implement it in Mnesia too. > >This is true, and I agree. However, it does allow Oracle to easily >handle >2GB datafiles on Unixes that cannot deal with it. It also >lets you stick to 32 bit file offsets by adding a file number >``prefix''. I must confess that I haven't kept up with OS vs DBMS design in the past few years, but it used to be commonly accepted that you simply couldn't build a really fast DBMS on top of the standard file and memory management provided by the leading operating systems -- certainly not if you wanted similar behaviour across multiple platforms. I don't know if it's still true... One DBMS I worked with was Cincom's SUPRA. I remember that you had the choice upon installing the database whether you wanted it to reside on a normal file system (good for testing) or on a raw partition (good for speed). In the case of the raw partition, SUPRA would use its own file I/O driver. I agree that the problem is worse for mnesia, since it must deal with variable size objects. I know that work is ongoing to rewrite dets for much better performance. One of the biggies is that an Erlang program shall be able to perform multiple disk operations in one instruction to the file driver. This should be a big booster for dets. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From etxuwig@REDACTED Wed Jan 3 10:24:43 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 3 Jan 2001 10:24:43 +0100 (MET) Subject: job regulation (was Re: Mnesia disk performance (was RE: multi-attribute mnesia indexes?)) In-Reply-To: <20010102154916.B26255@spearce.org> Message-ID: On Tue, 2 Jan 2001, Shawn Pearce wrote: >I for one would like to be able to force my transactions (write that >is) to wait for the log writer to finish writing them if the problem >is that mnesia will overload like this. Should I step up the >frequency of my log writer in order to force it to write more >frequently, and hopefully at least simulate that the writes are >waiting for the log? The right way to do this is probably to introduce job scheduling for transactions. At AXD 301, we've had reason to think very hard about load regulation -- with pretty fantastic results, I might add: the AXD 301 should be almost impervious to denial-of-service attacks, and easily meets the BellCore requirement of 90% throughput at 150% continuous load. What we've found though, is that for really effective load regulation, _all_ significant jobs in the system should be made queuable in a job scheduler. Since we can't do this with mnesia (no hooks for load regulation), our job scheduler samples the "background load" and takes this into account. I would really like to se a generic framework for plugging in a load regulator in an OTP system. The default behaviour should be "no regulation", and it should be possible to use different load regulators (but with common semantics) for different products. For mnesia, I lean towards the following three measures: - provide for synchronous transactions: these would work similarly to sync_dirty, i.e. they return when the transaction is committed on all nodes. - make it possible/configurable to force a log dump before returning to the caller. I suggested a wrapper before (still haven't tested it myself). Would that method work? - make it possible to hook log dumps into a load regulator. This would require a framework for load regulation as mentioned above. To complete the picture, the programs starting transactions would of course also be load regulated. As mnesia cannot know the priority and total cost of a transaction, this would have to be done by the applications. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From Chandrashekhar.Mullaparthi@REDACTED Wed Jan 3 10:31:50 2001 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Wed, 3 Jan 2001 09:31:50 -0000 Subject: Formatting style? Message-ID: <402DD461F109D411977E0008C791C31202A79897@imp02mbx.one2one.co.uk> Do you find this more readable?? trade_with_agent(Agent, #trade_task{mode=Mode, market=Market}, Bid) -> BidAgentId = Market:bid_agent_id(Bid), {Buyer, Seller} = case Mode of buy -> {Agent, BidAgentId}; sell -> {BidAgentId, Agent} end, Id = make_trade(Buyer, Seller, Market, Bid), io:format("Agent ~p ~p in ~p~n", [agent:id(Agent), Mode, Id]), agent:send(BidAgentId, {trade, Mode, Id}). cheers, Chandru > -----Original Message----- > From: Shawn Pearce [mailto:spearce@REDACTED] > Sent: 3 January 2001 03:30 > To: erlang-questions@REDACTED > Subject: Formatting style? > > > Hey, I'm just curious, how do the ``expert'' Erlang programmers > format this code: > > trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> > Seller = Market:bid_agent_id(Bid), > Id = make_trade(Agent, Seller, Market, Bid), > io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), > agent:send(Seller, {trade, buy, Id}); > trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) -> > Buyer = Market:bid_agent_id(Bid), > Id = make_trade(Buyer, Agent, Market, Bid), > io:format("Agent ~p sell in ~p~n", [agent:id(Agent), Id]), > agent:send(Buyer, {trade, sell, Id}). > > I find it difficult to read that they are the same function, just > different varients of trade_with_agent/4. > > I'm just talking about white space and formatting conventions, however > comments about the function's arguments are certainly welcome as well. > > -- > Shawn. > > ``If this had been a real > life, you would have > received instructions > on where to go and what > to do.'' > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Wed Jan 3 10:41:17 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 3 Jan 2001 10:41:17 +0100 (MET) Subject: Formatting style? In-Reply-To: <20010102223024.E26255@spearce.org> Message-ID: To begin with, Emacs would use the following indention: trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> Seller = Market:bid_agent_id(Bid), Id = make_trade(Agent, Seller, Market, Bid), io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), agent:send(Seller, {trade, buy, Id}); trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) -> Buyer = Market:bid_agent_id(Bid), Id = make_trade(Buyer, Agent, Market, Bid), io:format("Agent ~p sell in ~p~n", [agent:id(Agent), Id]), agent:send(Buyer, {trade, sell, Id}). In order to make it clear that it's one function, I'd make sure never to put two different functions back-to-back, with no whitespace between them. Thus, the fact that the second function clause follows with no whitespace is a good indicator that it's the same function. However, sometimes, whitespace between function clauses makes it easier to read the code. Then, I would use a single blank line. You can also use comments to delineate functions. A good convention, I think, is to put something like this ahead of the first function clause: %% trade_with_agent/3 -> ok. %% trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> Seller = Market:bid_agent_id(Bid), Id = make_trade(Agent, Seller, Market, Bid), io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), agent:send(Seller, {trade, buy, Id}); Sometimes, one would like to add a description about a function: %% trade_with_agent/3 -> ok. %% Description.... %% trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> If I also want to put a comment for each function clause, I'd put it inside the function: %% trade_with_agent/3 -> ok. %% Description.... %% trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> %% To buy... Seller = Market:bid_agent_id(Bid), Id = make_trade(Agent, Seller, Market, Bid), io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), agent:send(Seller, {trade, buy, Id}); trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) -> %% to sell... Buyer = Market:bid_agent_id(Bid), Of course, if you use Emacs, function heads, comments, and other interesting language elements will be highlighted to your liking. /Uffe On Tue, 2 Jan 2001, Shawn Pearce wrote: >Hey, I'm just curious, how do the ``expert'' Erlang programmers >format this code: > >trade_with_agent(Agent, #trade_task{mode=buy, market=Market}, Bid) -> > Seller = Market:bid_agent_id(Bid), > Id = make_trade(Agent, Seller, Market, Bid), > io:format("Agent ~p buy in ~p~n", [agent:id(Agent), Id]), > agent:send(Seller, {trade, buy, Id}); >trade_with_agent(Agent, #trade_task{mode=sell, market=Market}, Bid) -> > Buyer = Market:bid_agent_id(Bid), > Id = make_trade(Buyer, Agent, Market, Bid), > io:format("Agent ~p sell in ~p~n", [agent:id(Agent), Id]), > agent:send(Buyer, {trade, sell, Id}). > >I find it difficult to read that they are the same function, just >different varients of trade_with_agent/4. > >I'm just talking about white space and formatting conventions, >however comments about the function's arguments are certainly >welcome as well. > >-- >Shawn. > > ``If this had been a real > life, you would have > received instructions > on where to go and what > to do.'' > -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From ak@REDACTED Wed Jan 3 10:51:43 2001 From: ak@REDACTED (Andi Kleen) Date: Wed, 3 Jan 2001 10:51:43 +0100 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: ; from etxuwig@etxb.ericsson.se on Wed, Jan 03, 2001 at 10:08:25AM +0100 References: <20010102165431.D26255@spearce.org> Message-ID: <20010103105143.A28436@gruyere.muc.suse.de> On Wed, Jan 03, 2001 at 10:08:25AM +0100, Ulf Wiger wrote: > I must confess that I haven't kept up with OS vs DBMS design in the > past few years, but it used to be commonly accepted that you simply > couldn't build a really fast DBMS on top of the standard file and > memory management provided by the leading operating systems -- > certainly not if you wanted similar behaviour across multiple > platforms. I don't know if it's still true... The file systems have catched up a lot and often databases are run in files these days now. On a modern extent based fs with preallocated files you basically do raw IO in the extents. If you want 100% the same behaviour everywhere you'll of course need to do it from scratch, but it'll cost you in effort, and increases the mainteance effort required by administrators a lot. > > One DBMS I worked with was Cincom's SUPRA. I remember that you had the > choice upon installing the database whether you wanted it to reside on > a normal file system (good for testing) or on a raw partition (good > for speed). In the case of the raw partition, SUPRA would use its own > file I/O driver. Not really an option anymore (using own drivers), except for some very special cases. -Andi From CLSDCLKS@REDACTED Wed Jan 3 01:14:55 2001 From: CLSDCLKS@REDACTED (CLSDCLKS@REDACTED) Date: Wed, 3 Jan 2001 01:14:55 Subject: No subject Message-ID: <166.70445.235514@mail.mindspring.com> GET YOUR OWN 100 MEG WEBSITE FOR ONLY $11.95 PER MONTH TODAY! STOP PAYING $19.95 or more TODAY for your web site, WHEN YOU CAN GET ONE FOR ONLY $11.95 PER MONTH! DO YOU ALREADY HAVE A WEBSITE? ALL YOU HAVE TO DO IS TRANSFER THE DOMAIN TO OUR SERVERS AND UPLOAD YOUR DATA AND YOU ARE READY TO GO! YOUR NEW WEB SPACE CAN BE CREATED INSTANTLY WITH JUST A SIMPLE PHONE CALL TO OUR OFFICE. YOU CAN CHANGE THE DESIGN OF YOUR SITE AS MUCH AS YOU WANT with no extra charge! UNLIMITED TRAFFIC -- no extra charge! FRONT PAGE EXTENSIONS are FULLY SUPPORTED. A SET UP FEE OF $40.00 APPLIES for FIRST TIME CUSTOMERS. ALL FEES PREPAID IN ADVANCE FOR THE YEAR PLUS A $40.00 SET UP CHARGE. FOR DETAILS CALL 1 888 248 0765 if you are outside the USA, please fax 240 337 8325 Webhosting International From dg@REDACTED Wed Jan 3 21:07:21 2001 From: dg@REDACTED (David Gould) Date: Wed, 3 Jan 2001 12:07:21 -0800 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010102220556.A18449@gruyere.muc.suse.de>; from ak@suse.de on Tue, Jan 02, 2001 at 10:05:56PM +0100 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> <20010102220556.A18449@gruyere.muc.suse.de> Message-ID: <20010103120721.C20570@archimedes.oak.suse.com> On Tue, Jan 02, 2001 at 10:05:56PM +0100, Andi Kleen wrote: > On Tue, Jan 02, 2001 at 03:49:16PM -0500, Shawn Pearce wrote: > > Oracle does this with their database and it is a big performance > > booster. The other thing they do is allow a table to be striped > > across multiple disks by making a table exist in multiple file system > > files at once. (They stripe disk allocations across the files.) This > > does help to manage larger tables as well. > > Near all modern OS can do that themselves using volume managers and software > RAID -- it would probably be a waste of time to implement it in Mnesia too. > > -Andi (Psst, Andi, what are you doing on this list? ;-) ) Anyway, it is still very worthwhile to be able to place tables and indexes by name from the DB or application and not rely on raid or lvm systems to do this automagically. The DBA or app designer can know quite a lot about access patterns and paths and use this to assign table fragments and indexes that are used at the same time to separate spindles or even controllers/buses. And one almost always wants to place transaction (undo/redo) logs on separate spindles/paths from data spaces. It is useful to have an lvm or raid system to make manageing storage easier and safer and more flexible, but in the end, you need to be able to place specific chunks'o'stuff (technical database term) onto specific logical volumes or raid sets anyway to be able to control parallism of spindles/actuators and not overload controllers or buses. How hard would it be to add the capability of specifying a path of some kind to mnesia/dets tables/indexes/logs ets? -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From dg@REDACTED Wed Jan 3 21:12:04 2001 From: dg@REDACTED (David Gould) Date: Wed, 3 Jan 2001 12:12:04 -0800 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: ; from etxuwig@etxb.ericsson.se on Wed, Jan 03, 2001 at 10:08:25AM +0100 References: <20010102165431.D26255@spearce.org> Message-ID: <20010103121204.D20570@archimedes.oak.suse.com> On Wed, Jan 03, 2001 at 10:08:25AM +0100, Ulf Wiger wrote: > > I must confess that I haven't kept up with OS vs DBMS design in the > past few years, but it used to be commonly accepted that you simply > couldn't build a really fast DBMS on top of the standard file and > memory management provided by the leading operating systems -- > certainly not if you wanted similar behaviour across multiple > platforms. I don't know if it's still true... Mostly still true in the hardcore DBMS world, but better/easier than it used to be. > choice upon installing the database whether you wanted it to reside on > a normal file system (good for testing) or on a raw partition (good > for speed). In the case of the raw partition, SUPRA would use its own > file I/O driver. This is still common, it depends really on whether the OS provides both unbuffered and asynchronous I/O to files (eg, VMS, NT, some unix), or only to raw disks (eg, some unix, current Linux (work in progress)). The real issue is unbuffered and asynch I/O, DBMSs are happy to use a filesystem if it can provide these features. -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From klacke@REDACTED Wed Jan 3 23:10:06 2001 From: klacke@REDACTED (Klacke) Date: Wed, 3 Jan 2001 23:10:06 +0100 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010103120721.C20570@archimedes.oak.suse.com>; from dg@suse.com on Wed, Jan 03, 2001 at 12:07:21PM -0800 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> <20010102220556.A18449@gruyere.muc.suse.de> <20010103120721.C20570@archimedes.oak.suse.com> Message-ID: <20010103231006.A10532@bluetail.com> On Wed, Jan 03, 2001 at 12:07:21PM -0800, David Gould wrote: > On Tue, Jan 02, 2001 at 10:05:56PM +0100, Andi Kleen wrote: > > How hard would it be to add the capability of specifying a path of some > kind to mnesia/dets tables/indexes/logs ets? > This would be pretty straightforward, maybe one directory per table (specified in create_table) and one directory for the logs /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke -- From spearce@REDACTED Thu Jan 4 00:35:58 2001 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 3 Jan 2001 18:35:58 -0500 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010103231006.A10532@bluetail.com>; from klacke@bluetail.com on Wed, Jan 03, 2001 at 11:10:06PM +0100 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> <20010102220556.A18449@gruyere.muc.suse.de> <20010103120721.C20570@archimedes.oak.suse.com> <20010103231006.A10532@bluetail.com> Message-ID: <20010103183558.A2817@spearce.org> Klacke scrawled: > On Wed, Jan 03, 2001 at 12:07:21PM -0800, David Gould wrote: > > On Tue, Jan 02, 2001 at 10:05:56PM +0100, Andi Kleen wrote: > > > > How hard would it be to add the capability of specifying a path of some > > kind to mnesia/dets tables/indexes/logs ets? > > > > This would be pretty straightforward, maybe one directory per table > (specified in create_table) and one directory for the logs As a create_table option? {atomic, ok} = mnesia:create_table(sequence, [{disc_copies, [node()]}, {directory, "/mnesia01"}, {attributes, record_info(fields, sequence)}]) My only concern is that not all nodes in a distribued database would want to store the tables necesarily at the same directory path. (Different drive structures for instance.) What about making the path always relative to the mnesia directory given on the command line to erts? Then if you want to relocate the files of a table to another disk, you can make a symlink in the mnesia data directory to point to a directory on the other disk. So long as all nodes have the same structure of their mnesia directory, your safe. This is assuming that all OSes have a good notion of symlinks. I'm no Windows guru, but this makes me think that perhaps its not a good idea to do with Windows. The other option is to make either in schema or a new table that goes with schema that records the name of a table, the name of the node and the directory path of the storage file for the table. If mnesia could bring the system tables 'schema' and 'table_storage' online, and ignore all other tables, the user could move the file, update the mnesia system table 'table_storage', and then bring the system up the rest of the way. Oracle does this. I'm sure other database vendors do too. Maybe rather than store the files in dets they could be stored in a config file that is parsed at mnesia startup. That way its changeable before one starts up mnesia. If an entry doesn't exist in the config file, the default location (mnesia directory) could be used. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From spearce@REDACTED Thu Jan 4 00:44:40 2001 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 3 Jan 2001 18:44:40 -0500 Subject: Spatial indexing in mnesia Message-ID: <20010103184440.B2817@spearce.org> Has anyone ever considered storing spatial data in mnesia? It requires creating a different style of indexing than dets must use for lookup of records.... Oracle implements their spatial indexes as an auxiliary table that stores each node of the spatial index tree as a row in the table. This table is then indexed using traditional b*-tree indexes for performance. We'd like to stay with mnesia, but we're running into the trouble of overloading mnesia's log writer, and being faced with the need to do spatial data. I'm afraid performance will suck if we have to implement a spatial index as a standard dets table, as we'd be doing 20 or 30 read calls to mnesia just to do the lookup in the spatial index, then turn around and perform another read call to load the actual record we wanted. Doing this for a few hundred lookups at a time will choke mnesia as far as reading goes, right? Is this like ``far out there research'' type stuff to be doing with such a high-level language as Erlang? Mnesia is great, but it strikes me that its performance is limited by the language's own constraints of lists and tuples, none of which can be fixed-length or blocked together like one can do in C. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From dg@REDACTED Thu Jan 4 03:11:26 2001 From: dg@REDACTED (David Gould) Date: Wed, 3 Jan 2001 18:11:26 -0800 Subject: Mnesia disk performance (was RE: multi-attribute mnesia indexes?) In-Reply-To: <20010103183558.A2817@spearce.org>; from spearce@spearce.org on Wed, Jan 03, 2001 at 06:35:58PM -0500 References: <402DD461F109D411977E0008C791C3125654EC@imp02mbx.one2one.co.uk> <20010102154916.B26255@spearce.org> <20010102220556.A18449@gruyere.muc.suse.de> <20010103120721.C20570@archimedes.oak.suse.com> <20010103231006.A10532@bluetail.com> <20010103183558.A2817@spearce.org> Message-ID: <20010103181126.A21454@archimedes.oak.suse.com> On Wed, Jan 03, 2001 at 06:35:58PM -0500, Shawn Pearce wrote: > Klacke scrawled: > > On Wed, Jan 03, 2001 at 12:07:21PM -0800, David Gould wrote: > > > On Tue, Jan 02, 2001 at 10:05:56PM +0100, Andi Kleen wrote: > > > > > > How hard would it be to add the capability of specifying a path of some > > > kind to mnesia/dets tables/indexes/logs ets? > > > > > > > This would be pretty straightforward, maybe one directory per table > > (specified in create_table) and one directory for the logs > > As a create_table option? > > {atomic, ok} = mnesia:create_table(sequence, > [{disc_copies, [node()]}, > {directory, "/mnesia01"}, > {attributes, record_info(fields, sequence)}]) > > My only concern is that not all nodes in a distribued database would > want to store the tables necesarily at the same directory path. > (Different drive structures for instance.) Exactly. It really needs to be a per table/per node option. > What about making the path always relative to the mnesia directory > given on the command line to erts? Then if you want to relocate the > files of a table to another disk, you can make a symlink in the mnesia > data directory to point to a directory on the other disk. So long as > all nodes have the same structure of their mnesia directory, your safe. This could work. > This is assuming that all OSes have a good notion of symlinks. I'm no > Windows guru, but this makes me think that perhaps its not a good idea > to do with Windows. Er, except on Windows. > The other option is to make either in schema or a new table that goes > with schema that records the name of a table, the name of the node > and the directory path of the storage file for the table. If mnesia > could bring the system tables 'schema' and 'table_storage' online, > and ignore all other tables, the user could move the file, update the > mnesia system table 'table_storage', and then bring the system up the > rest of the way. Oracle does this. I'm sure other database vendors do > too. This is how Postgresql, Sybase, and Informix do it too. As far as I know it is the "usual way". Of course for Mnesia this would want to be a replicated table indexed on "node, table". -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From dg@REDACTED Thu Jan 4 03:29:16 2001 From: dg@REDACTED (David Gould) Date: Wed, 3 Jan 2001 18:29:16 -0800 Subject: Spatial indexing in mnesia In-Reply-To: <20010103184440.B2817@spearce.org>; from spearce@spearce.org on Wed, Jan 03, 2001 at 06:44:40PM -0500 References: <20010103184440.B2817@spearce.org> Message-ID: <20010103182916.C21454@archimedes.oak.suse.com> On Wed, Jan 03, 2001 at 06:44:40PM -0500, Shawn Pearce wrote: > Has anyone ever considered storing spatial data in mnesia? It requires > creating a different style of indexing than dets must use for lookup of > records.... > > Oracle implements their spatial indexes as an auxiliary table that > stores each node of the spatial index tree as a row in the table. This > table is then indexed using traditional b*-tree indexes for performance. Informix and Illustra before it, and Postgresql before that (and I think maybe also DB2) do this using multidimensional indexes, usually based on R-trees. > We'd like to stay with mnesia, but we're running into the trouble of > overloading mnesia's log writer, and being faced with the need to do > spatial data. > > I'm afraid performance will suck if we have to implement a spatial index > as a standard dets table, as we'd be doing 20 or 30 read calls to mnesia > just to do the lookup in the spatial index, then turn around and perform > another read call to load the actual record we wanted. Doing this for > a few hundred lookups at a time will choke mnesia as far as reading > goes, right? > > Is this like ``far out there research'' type stuff to be doing with such > a high-level language as Erlang? Mnesia is great, but it strikes me > that its performance is limited by the language's own constraints of > lists and tuples, none of which can be fixed-length or blocked together > like one can do in C. I think the thing to do might be to either implement R-trees in Erlang and add it to Mnesia, or to write a port driver that used an external R-Tree library or server. Might be able to use postgresql directly, or borrow the R-tree code from it (assuming they haven't done anything foolish like fail to maintain it...). -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From etxuwig@REDACTED Thu Jan 4 10:18:42 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Thu, 4 Jan 2001 10:18:42 +0100 (MET) Subject: Spatial indexing in mnesia In-Reply-To: <20010103182916.C21454@archimedes.oak.suse.com> Message-ID: On Wed, 3 Jan 2001, David Gould wrote: >On Wed, Jan 03, 2001 at 06:44:40PM -0500, Shawn Pearce wrote: >> Has anyone ever considered storing spatial data in mnesia? It requires >> creating a different style of indexing than dets must use for lookup of >> records.... >> >> Oracle implements their spatial indexes as an auxiliary table that >> stores each node of the spatial index tree as a row in the table. This >> table is then indexed using traditional b*-tree indexes for performance. > >Informix and Illustra before it, and Postgresql before that (and I >think maybe also DB2) do this using multidimensional indexes, >usually based on R-trees. I wrote a user contrib called gridfile-1.0 which could handle spatial data. I'm pretty sure that noone's been using it, because I've found out that it doesn't work. /-: I'm working on a new version, which hopefully will both be correct and have better scalability. The idea was taken from the article "The Grid File: An Adaptable, Symmetric Multikey File Structure", by L. Nievergelt, H. Hinterberger, published in "Readings in Database Systems", 2nd Ed, pp 108-24. The really nice property was that you could do range matching in time proportional to the number of objects found -- not to the size of the table. The main reason why I failed to make it work, of course, was hybris. Being warped on Erlang, I naturally wanted it to be able to operate on any type of key (not just integers, as in the article). This makes splitting and merging more of a challenge. I also wanted to support walking the grid in any dimension, with perfectly well defined semantics (user-configurable, naturally). This proved rather complicated. If somebody else is really interested, I could finish my new version. I could also try to make rdbms support derived indeces (difficult, due to problems with atomicity in trigger actions, but I have at least an approach to tackle that - still, hacking mnesia might be the better option.) /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From dg@REDACTED Thu Jan 4 11:02:53 2001 From: dg@REDACTED (David Gould) Date: Thu, 4 Jan 2001 02:02:53 -0800 Subject: Spatial indexing in mnesia In-Reply-To: ; from etxuwig@etxb.ericsson.se on Thu, Jan 04, 2001 at 10:18:42AM +0100 References: <20010103182916.C21454@archimedes.oak.suse.com> Message-ID: <20010104020253.A23035@archimedes.oak.suse.com> On Thu, Jan 04, 2001 at 10:18:42AM +0100, Ulf Wiger wrote: > On Wed, 3 Jan 2001, David Gould wrote: > > I wrote a user contrib called gridfile-1.0 which could handle spatial > data. I'm pretty sure that noone's been using it, because I've found > out that it doesn't work. /-: I'm working on a new version, which > hopefully will both be correct and have better scalability. What doesn't work? Can it be fixed just to tide us by? > The idea was taken from the article "The Grid File: An Adaptable, > Symmetric Multikey File Structure", by L. Nievergelt, H. Hinterberger, > published in "Readings in Database Systems", 2nd Ed, pp 108-24. Right, is that the silver cover edition, or an earlier one? Mine is at work and I am not. Anyway, about 20 pages + or - from there is the paper by Antonin Guttman defining R-Trees which as far as I last knew are the prefered spatial index type. Funny thing: at Illustra (and later Informix), I worked with a guy named Tony on some memory leaks and other integration bugs (we had a difficult runtime environment) in the spatial index code, and as sometimes happens when one is fixing someone elses bugs, I was kinda grumpy about it. "Who wrote all this cruft, why do we let this kinda slop get checked in" and so forth although it wasn't really that bad. It must have been about a year later when I tumbled to the fact that "Tony" was short for "Antonin". Sheesh. I wish I could say I was smarter now and wouldn't do that again... > The really nice property was that you could do range matching in time > proportional to the number of objects found -- not to the size of the > table. I will have a look. Thanks for the pointer. > If somebody else is really interested, I could finish my new version. > I could also try to make rdbms support derived indeces (difficult, due > to problems with atomicity in trigger actions, but I have at least an > approach to tackle that ... > option.) That might be useful though, there are an awful lot of non-mnesia systems that are holding data hostage... -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From hal@REDACTED Thu Jan 4 18:29:08 2001 From: hal@REDACTED (Hal Snyder) Date: 04 Jan 2001 11:29:08 -0600 Subject: Spatial indexing in mnesia In-Reply-To: David Gould's message of "Thu, 4 Jan 2001 02:02:53 -0800" References: <20010103182916.C21454@archimedes.oak.suse.com> <20010104020253.A23035@archimedes.oak.suse.com> Message-ID: <87wvcbfcpn.fsf@ghidra.vail> David Gould writes: > Right, is that the silver cover edition, or an earlier one? Mine is > at work and I am not. Anyway, about 20 pages + or - from there is > the paper by Antonin Guttman defining R-Trees which as far as I last > knew are the prefered spatial index type. > > Funny thing: at Illustra (and later Informix), I worked with a guy > named Tony on some memory leaks and other integration bugs (we had a > difficult runtime environment) in the spatial index code, and as > sometimes happens when one is fixing someone elses bugs, I was kinda > grumpy about it. "Who wrote all this cruft, why do we let this kinda > slop get checked in" and so forth although it wasn't really that > bad. It must have been about a year later when I tumbled to the fact > that "Tony" was short for "Antonin". Sheesh. I wish I could say I > was smarter now and wouldn't do that again... A little OT maybe, but BTW we have been using PostgreSQL r-trees to locate nearest service provider - customer dials 800 number for a retail chain, we get long/lat from his number, look up nearest store in (r-tree indexed) database, and connect. We even optimized the search by preloading spatial data sorted in Hilbert curve order. The algorithms are subtle but not extremely lengthy - I bet the whole thing could be done nicely in Erlang/mnesia. Heck, maybe you could even use Erlang for some of the telephony... From dg@REDACTED Thu Jan 4 19:17:27 2001 From: dg@REDACTED (David Gould) Date: Thu, 4 Jan 2001 10:17:27 -0800 Subject: Spatial indexing in mnesia In-Reply-To: <87wvcbfcpn.fsf@ghidra.vail>; from hal@vailsys.com on Thu, Jan 04, 2001 at 11:29:08AM -0600 References: <20010103182916.C21454@archimedes.oak.suse.com> <20010104020253.A23035@archimedes.oak.suse.com> <87wvcbfcpn.fsf@ghidra.vail> Message-ID: <20010104101727.A23931@archimedes.oak.suse.com> On Thu, Jan 04, 2001 at 11:29:08AM -0600, Hal Snyder wrote: > > A little OT maybe, but BTW we have been using PostgreSQL r-trees to > locate nearest service provider - customer dials 800 number for a > retail chain, we get long/lat from his number, look up nearest store > in (r-tree indexed) database, and connect. We even optimized the > search by preloading spatial data sorted in Hilbert curve order. Nice. It is good to see at least some people are using PostgreSQL for some of its more advanced features, instead of just another SQL system. Presorting is a big win too, when you can get away with it. > The algorithms are subtle but not extremely lengthy - I bet the whole > thing could be done nicely in Erlang/mnesia. Heck, maybe you could > even use Erlang for some of the telephony... Thats what I was thinking. If someone had the time or the need of course. -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From Peter.Andersson@REDACTED Fri Jan 5 16:44:43 2001 From: Peter.Andersson@REDACTED (Peter Andersson) Date: Fri, 05 Jan 2001 15:44:43 +0000 Subject: Serial port driver for Erlang on Windows? Message-ID: <3A55EBEA.639DA23@eei.ericsson.se> Hi everyone, Johan Bevemyr has written a serial port driver for Erlang on UNIX (contributed to erlang.org). Has anyone done something similar for Windows? If not, I would still be grateful for any info or pointers that you could provide me with on this subject. I want to be able to run an Erlang application (using the UNIX serial port driver) on Windows as well, but I don't have any experience of low-level Windows programming. (Is Johan's ANSI C driver easily ported? How would e.g. opening and connecting to a /dev/ttya,b,... device in Unix be accomplished in Windows using the Com1,2,... abstractions?). Regards /Peter From sam@REDACTED Fri Jan 5 20:00:51 2001 From: sam@REDACTED (Samuel Tardieu) Date: Fri, 5 Jan 2001 20:00:51 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? Message-ID: <2001-01-05-20-00-51+trackit+sam@inf.enst.fr> I wonder if this code in prim_inet is correct when using an UDP socket in passive and binary modes: recvfrom0(S, Length, Time) when port(S), integer(Length), Length >= 0 -> case ctl_cmd(S, ?UDP_REQ_RECV,[enc_time(Time),?int32(Length)]) of {ok,[R1,R0]} -> Ref = ?u16(R1,R0), receive {inet_async, S, Ref, {ok, [F,P1,P0 | AddrData]}} -> {IP,Data} = get_ip(F, AddrData), {ok, {IP, ?u16(P1,P0), Data}}; {inet_async, S, Ref, Status} -> Status end; Error -> Error end. If the UDP socket has the "binary" option set, then I think that the message that is received by the receive statement looks like {inet_async, S, Ref, {ok, <>}} which is covered by the default case instead of being covered explicitely, as the result of recvfrom0/3 does not hold the expected {ok, {IP, Port, Data}}. Of course, get_ip4/1 and get_ip6/1 (both called by get_ip/2) need a "binary" alternative too. Sam From tony@REDACTED Fri Jan 5 20:18:16 2001 From: tony@REDACTED (Tony Rogvall) Date: Fri, 05 Jan 2001 20:18:16 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? References: <2001-01-05-20-00-51+trackit+sam@inf.enst.fr> Message-ID: <3A561DF8.99ABDDE8@bluetail.com> Samuel Tardieu wrote: > I wonder if this code in prim_inet is correct when using an UDP socket in > passive and binary modes: > > recvfrom0(S, Length, Time) when port(S), integer(Length), Length >= 0 -> > case ctl_cmd(S, ?UDP_REQ_RECV,[enc_time(Time),?int32(Length)]) of > {ok,[R1,R0]} -> > Ref = ?u16(R1,R0), > receive > {inet_async, S, Ref, {ok, [F,P1,P0 | AddrData]}} -> > {IP,Data} = get_ip(F, AddrData), > {ok, {IP, ?u16(P1,P0), Data}}; > {inet_async, S, Ref, Status} -> > Status > end; > Error -> > Error > end. > > If the UDP socket has the "binary" option set, then I think that the > message that is received by the receive statement looks like > > {inet_async, S, Ref, {ok, <>}} > > which is covered by the default case instead of being covered explicitely, > as the result of recvfrom0/3 does not hold the expected {ok, {IP, Port, Data}}. > Of course, get_ip4/1 and get_ip6/1 (both called by get_ip/2) need a "binary" > alternative too. > > Sam >From inet_drv.c /* ** passive mode reply: ** {inet_async, S, Ref, {ok,[H1,...Hsz | Data]}} */ This means that the inet_drv ADDs a header list of sz bytes. In this case the header data is the Familiy, Port and Address, the rest my or may not be a binary. /Tony -------------- next part -------------- A non-text attachment was scrubbed... Name: tony.vcf Type: text/x-vcard Size: 319 bytes Desc: Card for Tony Rogvall URL: From sam@REDACTED Fri Jan 5 20:42:05 2001 From: sam@REDACTED (Samuel Tardieu) Date: Fri, 5 Jan 2001 20:42:05 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? In-Reply-To: <3A561DF8.99ABDDE8@bluetail.com>; from tony@bluetail.com on Fri, Jan 05, 2001 at 08:18:16PM +0100 References: <2001-01-05-20-00-51+trackit+sam@inf.enst.fr> <3A561DF8.99ABDDE8@bluetail.com> Message-ID: <2001-01-05-20-42-05+trackit+sam@inf.enst.fr> On 5/01, Tony Rogvall wrote: | From inet_drv.c | | /* | ** passive mode reply: | ** {inet_async, S, Ref, {ok,[H1,...Hsz | Data]}} | */ | | This means that the inet_drv ADDs a header list of sz bytes. In this case | the header data is the Familiy, Port and Address, the rest my or may not be a | binary. However, the following code: -module (bug). -export ([start_udp/0]). start_udp () -> {ok, U} = gen_udp:open (4161, [binary, {active, false}]), io:format ("Received: ~p~n", [prim_inet:recvfrom (U, 1500)]), erlang:halt (). gives, when a UDP packet is received on port 4161: {ok,<<1,12,73,127,0,0,1,0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1>>} If the binary option is removed, it gives: {ok,{{127,0,0,1}, 3154, [0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1]}} From klacke@REDACTED Sat Jan 6 15:16:18 2001 From: klacke@REDACTED (Klacke) Date: Sat, 6 Jan 2001 15:16:18 +0100 Subject: Serial port driver for Erlang on Windows? In-Reply-To: <3A55EBEA.639DA23@eei.ericsson.se>; from Peter.Andersson@eei.ericsson.se on Fri, Jan 05, 2001 at 03:44:43PM +0000 References: <3A55EBEA.639DA23@eei.ericsson.se> Message-ID: <20010106151618.B11175@bluetail.com> On Fri, Jan 05, 2001 at 03:44:43PM +0000, Peter Andersson wrote: > Johan Bevemyr has written a serial port driver for Erlang on UNIX (contributed > to erlang.org). Has anyone done something similar for Windows? If not, I would > still be grateful for any info or pointers that you could provide me with on > this subject. I want to be able to run an Erlang application (using the UNIX > serial port driver) on Windows as well, but I don't have any experience of > low-level Windows programming. (Is Johan's ANSI C driver easily ported? How > would e.g. opening and connecting to a /dev/ttya,b,... device in Unix be > accomplished in Windows using the Com1,2,... abstractions?). > I actually once started to do this, It requires a lof of overlapped IO shit and stuff with the win32 API. I never got it work properly and then other stuff came in the way and I dropped it. However, a platform independand library to the serial ports would indeed be nice to have. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke -- From raimo@REDACTED Mon Jan 8 09:39:00 2001 From: raimo@REDACTED (Raimo Niskanen) Date: Mon, 08 Jan 2001 09:39:00 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? References: <2001-01-05-20-00-51+trackit+sam@inf.enst.fr>, <3A561DF8.99ABDDE8@bluetail.com>, <2001-01-05-20-42-05+trackit+sam@inf.enst.fr> Message-ID: <3A597CA4.C63C046D@erix.ericsson.se> Samuel Tardieu wrote: > > On 5/01, Tony Rogvall wrote: > > | From inet_drv.c > | > | /* > | ** passive mode reply: > | ** {inet_async, S, Ref, {ok,[H1,...Hsz | Data]}} > | */ > | > | This means that the inet_drv ADDs a header list of sz bytes. In this case > | the header data is the Familiy, Port and Address, the rest my or may not be a > | binary. > > However, the following code: > > -module (bug). > -export ([start_udp/0]). > > start_udp () -> > {ok, U} = gen_udp:open (4161, [binary, {active, false}]), > io:format ("Received: ~p~n", [prim_inet:recvfrom (U, 1500)]), > erlang:halt (). > > gives, when a UDP packet is received on port 4161: > > {ok,<<1,12,73,127,0,0,1,0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1>>} > > If the binary option is removed, it gives: > > {ok,{{127,0,0,1}, > 3154, > [0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1]}} The code in prim_inet is correct, but inet_drv.c needs some improvement. We will look into this. It seems like the binary UDP case is not handled correctly. / Raimo Niskanen, Ericsson Utvecklings AB - Erlang/OTP From voudheus@REDACTED Mon Jan 8 00:34:57 2001 From: voudheus@REDACTED (Karel Van Oudheusden) Date: Mon, 08 Jan 2001 00:34:57 +0100 Subject: machine code size of functional languages Message-ID: <3A58FD21.841847C1@imec.be> Greetings, I was just reading "A Comparison Between Erlang and C++ for Implementation of Telecom Applications" written by T. Aronsson and J Grafstrom. In the text the remark is made that applications written in functional languages (Haskell, Erlang) are generally shorter than applications written in imperative languages (C, C++). Does anybody have recent material (information) on this? I also assume that the source code size is meant. What about the machine code size? Are functional languages also shorter in machine code size than imperative ones? Does this depend on the kind of application, if so what kind? thanx, Karel V.O. From tony@REDACTED Mon Jan 8 00:01:36 2001 From: tony@REDACTED (Tony Rogvall) Date: Mon, 08 Jan 2001 00:01:36 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? References: <2001-01-05-20-00-51+trackit+sam@inf.enst.fr> <3A561DF8.99ABDDE8@bluetail.com> <2001-01-05-20-42-05+trackit+sam@inf.enst.fr> Message-ID: <3A58F550.F179408D@bluetail.com> Samuel Tardieu wrote: > On 5/01, Tony Rogvall wrote: > > | From inet_drv.c > | > | /* > | ** passive mode reply: > | ** {inet_async, S, Ref, {ok,[H1,...Hsz | Data]}} > | */ > | > | This means that the inet_drv ADDs a header list of sz bytes. In this case > | the header data is the Familiy, Port and Address, the rest my or may not be a > | binary. > > However, the following code: > > -module (bug). > -export ([start_udp/0]). > > start_udp () -> > {ok, U} = gen_udp:open (4161, [binary, {active, false}]), > io:format ("Received: ~p~n", [prim_inet:recvfrom (U, 1500)]), > erlang:halt (). > > gives, when a UDP packet is received on port 4161: > > {ok,<<1,12,73,127,0,0,1,0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1>>} > > If the binary option is removed, it gives: > > {ok,{{127,0,0,1}, > 3154, > [0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1]}} Yes you are absolutely right, by demonstration :-) If you need a quick fix you can update the inet_drv as follows: (I can not produce a clean patch right now, I hope some one at OTP team can do it for us) for simplicity replace the following functions (a proper emacs mode will fix the looks of this) /Tony ------------------START CUTTING AND PASTING ---------------------------- static int inet_async_binary_data(desc, phsz, bin, offs, len) inet_descriptor* desc; unsigned int phsz; DriverBinary* bin; int offs; int len; { unsigned int hsz = desc->hsz + phsz; DriverTermData spec[20]; DriverTermData caller = desc->caller; int aid; int req; int i = 0; DEBUGF(("inet_async_binary_data(%d): offs=%d, len = %d\r\n", desc->port, offs, len)); if (deq_async(desc, &aid, &caller, &req) < 0) return -1; i = LOAD_ATOM(spec, i, am_inet_async); i = LOAD_PORT(spec, i, desc->dport); i = LOAD_INT(spec, i, aid); i = LOAD_ATOM(spec, i, am_ok); if ((desc->mode == INET_MODE_LIST) || (hsz > len)) { /* INET_MODE_LIST => [H1,H2,...Hn] */ i = LOAD_STRING(spec, i, bin->orig_bytes+offs, len); } else { /* INET_MODE_BINARY => [H1,H2,...HSz | Binary] */ int sz = len - hsz; i = LOAD_BINARY(spec, i, bin, offs+hsz, sz); if (hsz > 0) i = LOAD_STRING_CONS(spec, i, bin->orig_bytes+offs, hsz); } i = LOAD_TUPLE(spec, i, 2); i = LOAD_TUPLE(spec, i, 4); ASSERT(i <= 20); desc->caller = 0; return driver_send_term(desc->port, caller, spec, i); } static int tcp_reply_binary_data(desc, bin, offs, len) tcp_descriptor* desc; DriverBinary* bin; int offs; int len; { int code; /* adjust according to packet type */ switch(desc->inet.htype) { case TCP_PB_1: offs += 1; len -= 1; break; case TCP_PB_2: offs += 2; len -= 2; break; case TCP_PB_4: offs += 4; len -= 4; break; case TCP_PB_FCGI: len -= ((struct fcgi_head*)(bin->orig_bytes+offs))->paddingLength; break; } SCANBIT8(INETP(desc), bin->orig_bytes+offs, len); if (desc->inet.deliver == INET_DELIVER_PORT) code = inet_port_binary_data(INETP(desc), bin, offs, len); #ifdef USE_HTTP else if (desc->inet.htype == TCP_PB_HTTP) { if ((code = http_message(desc, bin->orig_bytes+offs, len)) < 0) http_error_message(desc, bin->orig_bytes+offs, len); code = 0; } #endif else if (desc->inet.active == INET_PASSIVE) return inet_async_binary_data(INETP(desc), 0, bin, offs, len); else code = tcp_binary_message(desc, bin, offs, len); if (code < 0) return code; if (desc->inet.active == INET_ONCE) desc->inet.active = INET_PASSIVE; return code; } static int udp_reply_binary_data(desc, hsz, bin, offs, len) inet_descriptor* desc; unsigned int hsz; DriverBinary* bin; int offs; int len; { int code; SCANBIT8(desc, bin->orig_bytes+offs, len); if (desc->active == INET_PASSIVE) return inet_async_binary_data(desc, hsz, bin, offs, len); else if (desc->deliver == INET_DELIVER_PORT) code = inet_port_binary_data(desc, bin, offs, len); else code = udp_binary_message(desc, bin, offs, len); if (code < 0) return code; if (desc->active == INET_ONCE) desc->active = INET_PASSIVE; return code; } static int udp_inet_input(desc, event) udp_descriptor* desc; HANDLE event; { int n; int len; inet_address other; char abuf[sizeof(inet_address)]; /* buffer address */ int sz; char* ptr; DriverBinary* buf; /* binary */ int packet_count = INET_UDP_POLL; int count = 0; /* number of packets delivered to owner */ while(packet_count--) { len = sizeof(other); sz = desc->inet.bufsz; /* Allocate space for message and address */ if ((buf = alloc_buffer(sz+len)) == NULL) return udp_error(desc, ENOMEM); ptr = buf->orig_bytes + len; /* point to message part */ /* Note: On Windows NT, recvfrom() fails if the socket is connected. */ if (desc->inet.state & INET_F_ACTIVE) { n = sock_recv(desc->inet.s, ptr, sz, 0); other = desc->inet.remote; } else n = sock_recvfrom(desc->inet.s, ptr, sz, 0, (struct sockaddr*)&other, &len); if (n == SOCKET_ERROR) { int err = sock_errno(); release_buffer(buf); if (err != ERRNO_BLOCK) { if (!desc->inet.active) { async_error(desc, err); driver_cancel_timer(desc->inet.port); sock_select(INETP(desc),FD_READ,0); } else { udp_error_message(desc, err); } } else if (!desc->inet.active) sock_select(INETP(desc),FD_READ,1); return count; /* strange, not ready */ } else { int offs; int nsz; int code; inet_input_count(INETP(desc), n); inet_get_address(desc->inet.sfamily, abuf, &other, &len); /* copy formatted address to ptr len is actual length */ sys_memcpy(ptr - len, abuf, len); ptr -= len; nsz = n + len; /* nsz = data + address */ offs = ptr - buf->orig_bytes; /* initial pointer offset */ /* check if we need to reallocate binary */ if ((desc->inet.mode == INET_MODE_BINARY) && (desc->inet.hsz < n) && (nsz < BIN_REALLOC_LIMIT(sz))) { DriverBinary* tmp; if ((tmp = realloc_buffer(buf,nsz+offs)) != NULL) buf = tmp; } code = udp_reply_binary_data(desc,(unsigned int)len,buf,offs,nsz); free_buffer(buf); if (code < 0) return count; count++; if (!desc->inet.active) { driver_cancel_timer(desc->inet.port); /* possibly cancel */ sock_select(INETP(desc),FD_READ,0); return count; /* passive mode (read one packet only) */ } } } return count; } ---------------------- YOU CAN STOP NOW ------------------------------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: tony.vcf Type: text/x-vcard Size: 319 bytes Desc: Card for Tony Rogvall URL: From thierry.mallard@REDACTED Mon Jan 8 13:45:55 2001 From: thierry.mallard@REDACTED (Thierry Mallard) Date: Mon, 8 Jan 2001 13:45:55 +0100 Subject: machine code size of functional languages In-Reply-To: <3A58FD21.841847C1@imec.be>; from voudheus@imec.be on Mon, Jan 08, 2001 at 12:34:57AM +0100 References: <3A58FD21.841847C1@imec.be> Message-ID: <20010108134555.A7793@calvin.ird.IDEALX.com> On Mon, Jan 08, 2001 at 12:34:57AM +0100, Karel Van Oudheusden wrote: > [ Erlang | C++ ] > In the text the remark is made that applications written in functional > languages > (Haskell, Erlang) are generally shorter than applications written in > imperative languages (C, C++). I'm not an experimented Erlang programmer, others here will surely confirm this. My small experience is that _yes_ it is much smaller to write (source code) and the program itself (the bytecode) is smaller too. Although I think I read that the recent release has larger file, for information purpose IIRC. > Are functional languages also shorter in machine code size than > imperative ones? Does this depend on the kind of application, if so > what kind? I think that it is mostly due to the fact that there is a separated virtual machine, whereas imperative language often embedded all the necessary functions. If you use several libraries when coding in C / C++, the program binary size will of course be much smaller. (See ? Standalone Erlang ? for similar effects). Once again, it's just my very personal first experiences with Erlang :-) Best regards to you all. -- Thierry Mallard | GnuPG key on pgp.ai.mit.edu http://IDEALX.com | key 0xA3D021CB http://thierry.mallard.com | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 249 bytes Desc: not available URL: From cahill@REDACTED Mon Jan 8 13:48:58 2001 From: cahill@REDACTED (cahill) Date: Mon, 08 Jan 2001 12:48:58 +0000 Subject: ODBC package test Message-ID: <3A59B73A.A7E7E6F7@ocean.ucc.ie> Is there any way to test that my odbc package is setup correct, and will communicate with my unixOdbc drivers. I have tried the basic.erl code supplied, but i cant get this to work, and im not sure wheter or not im implementing this properly or wether the problem is with my odbc drivers. I have started the MySql daemon, and compiled the basic.erl file on a named Erlang shell ( erl -name odbc1) . when i try to start the Basic.erl file i get the following error : (odbc1@REDACTED)8> basic:start(). ** exited: {noproc,{gen_server,call, [odbc_sup, {start_child, [{local,odbc1},[{client,<0.47.0>}],[]]}, infinity]}} ** any suggestions are welcomed. thanx adrian From tomas.pihl@REDACTED Mon Jan 8 07:42:59 2001 From: tomas.pihl@REDACTED (Tomas Pihl) Date: Mon, 8 Jan 2001 07:42:59 +0100 (CET) Subject: Serial port driver for Erlang on Windows? In-Reply-To: <3A55EBEA.639DA23@eei.ericsson.se> Message-ID: On Fri, 5 Jan 2001, Peter Andersson wrote: > > Hi everyone, > > Johan Bevemyr has written a serial port driver for Erlang on UNIX (contributed > to erlang.org). Has anyone done something similar for Windows? If not, I would > still be grateful for any info or pointers that you could provide me with on > this subject. I want to be able to run an Erlang application (using the UNIX > serial port driver) on Windows as well, but I don't have any experience of > low-level Windows programming. (Is Johan's ANSI C driver easily ported? How > would e.g. opening and connecting to a /dev/ttya,b,... device in Unix be > accomplished in Windows using the Com1,2,... abstractions?). You could try cygwin (http://sources.redhat.com/cygwin). I've used it for "porting" a *BSD application to Windows with good results. This particular application of mine included serialport access and all I did was to replace the /dev/tty? with /dev/com? in order to have it working on Windows. I was actually quite impressed with it beeing so easy. One thing I noticed though was I couldn't get the opening of the same port twice to work, ie. when you want to have one filedescriptor for reading and another one for writing using the same port. Don't know if this is a Windows restriction or a cygwin problem. -- Tomas Pihl tomas.pihl@REDACTED From ingvar.meyer@REDACTED Mon Jan 8 14:08:36 2001 From: ingvar.meyer@REDACTED (Ingvar Meyer) Date: Mon, 08 Jan 2001 14:08:36 +0100 Subject: ODBC package test Message-ID: <3A59BBD4.B459EB3A@uab.ericsson.se> Is there any way to test that my odbc package is setup correct, and will communicate with my unixOdbc drivers. Yes there are You should do the following way. 1 Compile odbc 2 Start erlang 3 write application:start(odbc). 4 Look in the manual at www.erlang.org/doc/current/lib/odbc-0.8.2/doc how start your odbc-application. /Ingvar -- Ingvar Meyer ingvar.meyer@REDACTED Ericsson Utvecklings AB Network Core Products Box 1505, SE-125 25 ?LVSJ? From raimo@REDACTED Tue Jan 9 08:44:10 2001 From: raimo@REDACTED (Raimo Niskanen) Date: Tue, 09 Jan 2001 08:44:10 +0100 Subject: UDP+binary+passive and prim_inet:recvfrom/3 bug? References: <3A561DF8.99ABDDE8@bluetail.com>, <2001-01-05-20-42-05+trackit+sam@inf.enst.fr>, <3A58F550.F179408D@bluetail.com> Message-ID: <3A5AC14A.1ADCC86F@erix.ericsson.se> I will affect these changes to OTP R7B, include them in a patch, and get back with more info about which patch. / Raimo Niskanen, Ericsson UAB, Erlang/OTP Tony Rogvall wrote: > > Samuel Tardieu wrote: > > > On 5/01, Tony Rogvall wrote: > > > > | From inet_drv.c > > | > > | /* > > | ** passive mode reply: > > | ** {inet_async, S, Ref, {ok,[H1,...Hsz | Data]}} > > | */ > > | > > | This means that the inet_drv ADDs a header list of sz bytes. In this case > > | the header data is the Familiy, Port and Address, the rest my or may not be a > > | binary. > > > > However, the following code: > > > > -module (bug). > > -export ([start_udp/0]). > > > > start_udp () -> > > {ok, U} = gen_udp:open (4161, [binary, {active, false}]), > > io:format ("Received: ~p~n", [prim_inet:recvfrom (U, 1500)]), > > erlang:halt (). > > > > gives, when a UDP packet is received on port 4161: > > > > {ok,<<1,12,73,127,0,0,1,0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1>>} > > > > If the binary option is removed, it gives: > > > > {ok,{{127,0,0,1}, > > 3154, > > [0,6,1,0,0,1,0,0,0,0,0,0,6,102,111,111,98,97,114,0,0,1,0,1]}} > > Yes you are absolutely right, by demonstration :-) > > If you need a quick fix you can update the inet_drv as follows: > (I can not produce a clean patch right now, I hope some one at OTP team can do it for > us) > > for simplicity replace the following functions (a proper emacs mode will fix the looks > of this) > > /Tony > > ------------------START CUTTING AND PASTING ---------------------------- > > static int inet_async_binary_data(desc, phsz, bin, offs, len) > inet_descriptor* desc; unsigned int phsz; > DriverBinary* bin; int offs; int len; > { > unsigned int hsz = desc->hsz + phsz; > DriverTermData spec[20]; > DriverTermData caller = desc->caller; > int aid; > int req; > int i = 0; > > DEBUGF(("inet_async_binary_data(%d): offs=%d, len = %d\r\n", > desc->port, offs, len)); > > if (deq_async(desc, &aid, &caller, &req) < 0) > return -1; > > i = LOAD_ATOM(spec, i, am_inet_async); > i = LOAD_PORT(spec, i, desc->dport); > i = LOAD_INT(spec, i, aid); > > i = LOAD_ATOM(spec, i, am_ok); > > if ((desc->mode == INET_MODE_LIST) || (hsz > len)) { > /* INET_MODE_LIST => [H1,H2,...Hn] */ > i = LOAD_STRING(spec, i, bin->orig_bytes+offs, len); > } > else { > /* INET_MODE_BINARY => [H1,H2,...HSz | Binary] */ > int sz = len - hsz; > i = LOAD_BINARY(spec, i, bin, offs+hsz, sz); > if (hsz > 0) > i = LOAD_STRING_CONS(spec, i, bin->orig_bytes+offs, hsz); > } > i = LOAD_TUPLE(spec, i, 2); > i = LOAD_TUPLE(spec, i, 4); > ASSERT(i <= 20); > desc->caller = 0; > return driver_send_term(desc->port, caller, spec, i); > } > > static int tcp_reply_binary_data(desc, bin, offs, len) > tcp_descriptor* desc; DriverBinary* bin; int offs; int len; > { > int code; > > /* adjust according to packet type */ > switch(desc->inet.htype) { > case TCP_PB_1: offs += 1; len -= 1; break; > case TCP_PB_2: offs += 2; len -= 2; break; > case TCP_PB_4: offs += 4; len -= 4; break; > case TCP_PB_FCGI: > len -= ((struct fcgi_head*)(bin->orig_bytes+offs))->paddingLength; > break; > } > > SCANBIT8(INETP(desc), bin->orig_bytes+offs, len); > > if (desc->inet.deliver == INET_DELIVER_PORT) > code = inet_port_binary_data(INETP(desc), bin, offs, len); > #ifdef USE_HTTP > else if (desc->inet.htype == TCP_PB_HTTP) { > if ((code = http_message(desc, bin->orig_bytes+offs, len)) < 0) > http_error_message(desc, bin->orig_bytes+offs, len); > code = 0; > } > #endif > else if (desc->inet.active == INET_PASSIVE) > return inet_async_binary_data(INETP(desc), 0, bin, offs, len); > else > code = tcp_binary_message(desc, bin, offs, len); > if (code < 0) > return code; > if (desc->inet.active == INET_ONCE) > desc->inet.active = INET_PASSIVE; > return code; > } > > static int udp_reply_binary_data(desc, hsz, bin, offs, len) > inet_descriptor* desc; unsigned int hsz; DriverBinary* bin; int offs; int len; > { > int code; > > SCANBIT8(desc, bin->orig_bytes+offs, len); > > if (desc->active == INET_PASSIVE) > return inet_async_binary_data(desc, hsz, bin, offs, len); > else if (desc->deliver == INET_DELIVER_PORT) > code = inet_port_binary_data(desc, bin, offs, len); > else > code = udp_binary_message(desc, bin, offs, len); > if (code < 0) > return code; > if (desc->active == INET_ONCE) > desc->active = INET_PASSIVE; > return code; > } > > static int udp_inet_input(desc, event) > udp_descriptor* desc; HANDLE event; > { > int n; > int len; > inet_address other; > char abuf[sizeof(inet_address)]; /* buffer address */ > int sz; > char* ptr; > DriverBinary* buf; /* binary */ > int packet_count = INET_UDP_POLL; > int count = 0; /* number of packets delivered to owner */ > > while(packet_count--) { > len = sizeof(other); > sz = desc->inet.bufsz; > /* Allocate space for message and address */ > if ((buf = alloc_buffer(sz+len)) == NULL) > return udp_error(desc, ENOMEM); > ptr = buf->orig_bytes + len; /* point to message part */ > > /* Note: On Windows NT, recvfrom() fails if the socket is connected. */ > if (desc->inet.state & INET_F_ACTIVE) { > n = sock_recv(desc->inet.s, ptr, sz, 0); > other = desc->inet.remote; > } > else > n = sock_recvfrom(desc->inet.s, ptr, sz, 0, > (struct sockaddr*)&other, &len); > if (n == SOCKET_ERROR) { > int err = sock_errno(); > release_buffer(buf); > if (err != ERRNO_BLOCK) { > if (!desc->inet.active) { > async_error(desc, err); > driver_cancel_timer(desc->inet.port); > sock_select(INETP(desc),FD_READ,0); > } > else { > udp_error_message(desc, err); > } > } > else if (!desc->inet.active) > sock_select(INETP(desc),FD_READ,1); > return count; /* strange, not ready */ > } > else { > int offs; > int nsz; > int code; > > inet_input_count(INETP(desc), n); > > inet_get_address(desc->inet.sfamily, abuf, &other, &len); > > /* copy formatted address to ptr len is actual length */ > sys_memcpy(ptr - len, abuf, len); > ptr -= len; > nsz = n + len; /* nsz = data + address */ > offs = ptr - buf->orig_bytes; /* initial pointer offset */ > > /* check if we need to reallocate binary */ > if ((desc->inet.mode == INET_MODE_BINARY) && > (desc->inet.hsz < n) && (nsz < BIN_REALLOC_LIMIT(sz))) { > DriverBinary* tmp; > if ((tmp = realloc_buffer(buf,nsz+offs)) != NULL) > buf = tmp; > } > code = udp_reply_binary_data(desc,(unsigned int)len,buf,offs,nsz); > free_buffer(buf); > if (code < 0) > return count; > count++; > if (!desc->inet.active) { > driver_cancel_timer(desc->inet.port); /* possibly cancel */ > sock_select(INETP(desc),FD_READ,0); > return count; /* passive mode (read one packet only) */ > } > } > } > return count; > } > > ---------------------- YOU CAN STOP NOW ------------------------------------- From Ciaran.Johnston@REDACTED Tue Jan 9 19:18:58 2001 From: Ciaran.Johnston@REDACTED (Ciaran Johnston) Date: Tue, 09 Jan 2001 18:18:58 +0000 Subject: JInterface Message-ID: <3A5B5612.BBFC803D@eei.ericsson.se> Hi, I am looking at ways of interfacing a java application with an Erlang node, and one of the better options appears to be JInterface. However the situation we want to use it in offers a few possible sticking points. Here's the lowdown: The Java application is running on a different system to the one running the Erlang node(s). We want to be able to communicate from this system to many other systems running an Erlang node. We don't want to have Erlang in any form installed on the system running the Java. We came up with this solution: to copy the Java source files from the R7B source code and build the JInterface application locally, on the relevant machine. We have done this but haven't managed to test it yet - we've had no end of software configuration problems. Can anyone anticipate a problem with this? Our other problem, a more worrying one, is the compatibility between R7B and R5B - the Erlang nodes are all running R5B. Are there any compatibility issues between these two versions bearing in mind that we are only using JInterface to send messages between the Java application and the Erlang node? In other words, can we do what we are trying to do? As I mentioned, we haven't been able to test it here yet. Thanks in advance, Ciaran. From Ciaran.Johnston@REDACTED Tue Jan 9 20:08:36 2001 From: Ciaran.Johnston@REDACTED (Ciaran Johnston) Date: Tue, 09 Jan 2001 19:08:36 +0000 Subject: JInterface References: <3A5B5612.BBFC803D@eei.ericsson.se> <3A5B5C24.71564BE4@ericsson.com> Message-ID: <3A5B61B4.793BF914@eei.ericsson.se> The trouble with that is that there _is_ no JInterface with R5B, so we can't use that one (or at least there is no documentation for it). We are not adding software from R7B to R5B, we are integrating it into our Java application. JInterface is a bunch of Java files that allow your java application to appear as a node to an erlang node. Your Java application can then send and receive messages with the erlang node, and as far as the erlang node is concerned it is communicating with another erlang node (at least this is my understanding - correct me if I'm wrong :-)). Thus all we need is for the syntax of the messages to be consistent from R5B to R7B (at least that is what we are hoping). Is this the case? Chris Williams wrote: > > Hi Ciaran, > If you use R5B you havce to use jinteface (R5B) for it.... > If you use R7B you should use jinteface (R7B) for it.... > One can not coppy files from R7B to R5B this will not work and > will not be supported by erlang/OTP and probably will not work! > Ciaran Johnston wrote: > > > > Hi, > > I am looking at ways of interfacing a java application with an Erlang > > node, and one of the better options appears to be JInterface. However > > the situation we want to use it in offers a few possible sticking > > points. Here's the lowdown: > > > > The Java application is running on a different system to the one running > > the Erlang node(s). We want to be able to communicate from this system > > to many other systems running an Erlang node. We don't want to have > > Erlang in any form installed on the system running the Java. We came up > > with this solution: to copy the Java source files from the R7B source > > code and build the JInterface application locally, on the relevant > > machine. We have done this but haven't managed to test it yet - we've > > had no end of software configuration problems. Can anyone anticipate a > > problem with this? > > > > Our other problem, a more worrying one, is the compatibility between R7B > > and R5B - the Erlang nodes are all running R5B. Are there any > > compatibility issues between these two versions bearing in mind that we > > are only using JInterface to send messages between the Java application > > and the Erlang node? In other words, can we do what we are trying to do? > > As I mentioned, we haven't been able to test it here yet. > > > > Thanks in advance, > > > > Ciaran. > > -- > ==================================================================== > Christopher Williams Phone: +353 902 31365 > Ericsson Systems ECN: 83021365 > Expertise Limited, Mob: +353 87 64 888 04 > Athlone, Fax: +353 902 31304 > Co.Westmeath, http://nosc.eei.ericsson.se/pdu_access/Lynx > Ireland chris.williams@REDACTED > ==================================================================== -- Ciaran Johnston Ericsson Systems Expertise Ltd., Athlone Co. Westmeath Eire email: Ciaran.Johnston@REDACTED Phone: +353 902 31274 From cesarini@REDACTED Tue Jan 9 20:12:01 2001 From: cesarini@REDACTED (Francesco Cesarini) Date: Tue, 09 Jan 2001 19:12:01 +0000 Subject: JInterface References: <3A5B5612.BBFC803D@eei.ericsson.se> <3A5B5C24.71564BE4@ericsson.com> <3A5B61B4.793BF914@eei.ericsson.se> Message-ID: <3A5B6281.55DD77FF@terminus.ericsson.se> > Thus all we need is for the syntax of the messages to be > consistent from R5B to R7B (at least that is what we are hoping). Is > this the case? Nope.. Does not work, as there are also changes and improvements in the Erlang distribution among releases, different versions of Erlang can not talk to each other (Unless of course, the distribution went untouched.. Which is definitively not the case between R5 and R7). I'm going home! Ciao, Francesco > > Chris Williams wrote: > > > > Hi Ciaran, > > If you use R5B you havce to use jinteface (R5B) for it.... > > If you use R7B you should use jinteface (R7B) for it.... > > One can not coppy files from R7B to R5B this will not work and > > will not be supported by erlang/OTP and probably will not work! > > Ciaran Johnston wrote: > > > > > > Hi, > > > I am looking at ways of interfacing a java application with an Erlang > > > node, and one of the better options appears to be JInterface. However > > > the situation we want to use it in offers a few possible sticking > > > points. Here's the lowdown: > > > > > > The Java application is running on a different system to the one running > > > the Erlang node(s). We want to be able to communicate from this system > > > to many other systems running an Erlang node. We don't want to have > > > Erlang in any form installed on the system running the Java. We came up > > > with this solution: to copy the Java source files from the R7B source > > > code and build the JInterface application locally, on the relevant > > > machine. We have done this but haven't managed to test it yet - we've > > > had no end of software configuration problems. Can anyone anticipate a > > > problem with this? > > > > > > Our other problem, a more worrying one, is the compatibility between R7B > > > and R5B - the Erlang nodes are all running R5B. Are there any > > > compatibility issues between these two versions bearing in mind that we > > > are only using JInterface to send messages between the Java application > > > and the Erlang node? In other words, can we do what we are trying to do? > > > As I mentioned, we haven't been able to test it here yet. > > > > > > Thanks in advance, > > > > > > Ciaran. > > > > -- > > ==================================================================== > > Christopher Williams Phone: +353 902 31365 > > Ericsson Systems ECN: 83021365 > > Expertise Limited, Mob: +353 87 64 888 04 > > Athlone, Fax: +353 902 31304 > > Co.Westmeath, http://nosc.eei.ericsson.se/pdu_access/Lynx > > Ireland chris.williams@REDACTED > > ==================================================================== > > -- > Ciaran Johnston > Ericsson Systems Expertise Ltd., > Athlone > Co. Westmeath > Eire > > email: Ciaran.Johnston@REDACTED > Phone: +353 902 31274 -- Francesco Cesarini Erlang/OTP consultant Cellular: INT+44-7776 250381 ECN: 832-707192 http://welcome.to/cesarini.consulting From Sean.Hinde@REDACTED Tue Jan 9 20:37:05 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 9 Jan 2001 19:37:05 -0000 Subject: JInterface Message-ID: <402DD461F109D411977E0008C791C312039F5C67@imp02mbx.one2one.co.uk> When faced with this problem here (interfacing business system to Erlang system) we looked at: CORBA - concluded it was overkill Jinterface - The Java guys here couldn't quite figure out how to make it run asynchronous - and didn't want to take on lots of "proprietary ericsson Java code" apparently. In your case it doesn't seem to be an option. Simple wireline protocol over a raw socket stream - I use a simple LF terminated protocol to talk from an Applet into an erlang gen_server - ok, but a bit grubby and low level. A feasible option and very easy in Erlang :-). XML over HTTP - this is what we chose. The Java side sends Erlang a HTTP POST containing some XML with the data. Erlang responds with an XML result. It's not very efficient but it does work and is quick to implement and change. I also saw something somewhere about a sun rpc implemenmtation for Erlang And I head of someone implementing a SOAP interface pretty easily (in effect XML over HTTP) - Sean > -----Original Message----- > From: Francesco Cesarini [mailto:cesarini@REDACTED] > Sent: 9 January 2001 19:12 > To: Ciaran Johnston; erlang-questions@REDACTED > Subject: Re: JInterface > > > > Thus all we need is for the syntax of the messages to be > > consistent from R5B to R7B (at least that is what we are hoping). Is > > this the case? > > Nope.. Does not work, as there are also changes and > improvements in the > Erlang distribution among releases, different versions of > Erlang can not > talk to each other (Unless of course, the distribution went > untouched.. > Which is definitively not the case between R5 and R7). > > > I'm going home! > > Ciao, > Francesco > > > > > Chris Williams wrote: > > > > > > Hi Ciaran, > > > If you use R5B you havce to use jinteface (R5B) for it.... > > > If you use R7B you should use jinteface (R7B) for it.... > > > One can not coppy files from R7B to R5B this will not work and > > > will not be supported by erlang/OTP and probably will not work! > > > Ciaran Johnston wrote: > > > > > > > > Hi, > > > > I am looking at ways of interfacing a java > application with an Erlang > > > > node, and one of the better options appears to be > JInterface. However > > > > the situation we want to use it in offers a few > possible sticking > > > > points. Here's the lowdown: > > > > > > > > The Java application is running on a different system > to the one running > > > > the Erlang node(s). We want to be able to communicate > from this system > > > > to many other systems running an Erlang node. We don't > want to have > > > > Erlang in any form installed on the system running the > Java. We came up > > > > with this solution: to copy the Java source files from > the R7B source > > > > code and build the JInterface application locally, on > the relevant > > > > machine. We have done this but haven't managed to test > it yet - we've > > > > had no end of software configuration problems. Can > anyone anticipate a > > > > problem with this? > > > > > > > > Our other problem, a more worrying one, is the > compatibility between R7B > > > > and R5B - the Erlang nodes are all running R5B. Are there any > > > > compatibility issues between these two versions bearing > in mind that we > > > > are only using JInterface to send messages between the > Java application > > > > and the Erlang node? In other words, can we do what we > are trying to do? > > > > As I mentioned, we haven't been able to test it here yet. > > > > > > > > Thanks in advance, > > > > > > > > Ciaran. > > > > > > -- > > > > ==================================================================== > > > Christopher Williams Phone: +353 902 31365 > > > Ericsson Systems ECN: 83021365 > > > Expertise Limited, Mob: +353 87 64 888 04 > > > Athlone, Fax: +353 902 31304 > > > Co.Westmeath, http://nosc.eei.ericsson.se/pdu_access/Lynx > > > Ireland chris.williams@REDACTED > > > > ==================================================================== > > > > -- > > Ciaran Johnston > > Ericsson Systems Expertise Ltd., > > Athlone > > Co. Westmeath > > Eire > > > > email: Ciaran.Johnston@REDACTED > > Phone: +353 902 31274 > > -- > Francesco Cesarini > > Erlang/OTP consultant > Cellular: INT+44-7776 250381 > ECN: 832-707192 > http://welcome.to/cesarini.consulting > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From scott@REDACTED Tue Jan 9 21:05:10 2001 From: scott@REDACTED (Scott Lystig Fritchie) Date: Tue, 09 Jan 2001 14:05:10 -0600 Subject: JInterface In-Reply-To: Message of "Tue, 09 Jan 2001 19:37:05 GMT." <402DD461F109D411977E0008C791C312039F5C67@imp02mbx.one2one.co.uk> Message-ID: <200101092005.OAA14214@snookles.snookles.com> >>>>> "sh" == Sean Hinde writes: sh> I also saw something somewhere about a sun rpc implemenmtation for sh> Erlang See http://www.erlang.org/user.html#rpc-1.0. -Scott From vances@REDACTED Tue Jan 9 21:06:05 2001 From: vances@REDACTED (Vance Shipley) Date: Tue, 9 Jan 2001 15:06:05 -0500 Subject: JInterface In-Reply-To: <3A5B6281.55DD77FF@terminus.ericsson.se> Message-ID: Francesco Cesarini writes: > Nope.. Does not work, as there are also changes and improvements in the > Erlang distribution among releases, different versions of Erlang can not > talk to each other (Unless of course, the distribution went untouched.. > Which is definitively not the case between R5 and R7). Well that statement is a bit strong isn't it? I have connected my desktop environment to other backend nodes running different versions. I would also point out that the release notes have many mentions of certain _issues_ involving ditribution between versions. I don't know about R5 <--> R7 though. I was told at one point that my commercial versions wouldn't talk to the opensource versions. Apparently this had to do with the security mechanisms used in the commercial systems not being released as opensource. -Vance From vances@REDACTED Tue Jan 9 21:17:39 2001 From: vances@REDACTED (Vance Shipley) Date: Tue, 9 Jan 2001 15:17:39 -0500 Subject: long names not working on Windows 2000 Message-ID: I installed R7B on my Windows 2000 workstation recently. I used the R7B-0 binaries on the erlang.org site. Today I tried to start it up using long names "-name foo" and it crashes (see log below). I see a message a while back saying that there had been a problem with long names on Win32 when using DHCP but it was fixed in R7B. I am not using DHCP it's just a fixed IP address on a LAN. Does this work for others? -Vance {error_logger,{{2001,1,9},{15,13,44}},'Can\'t set long node name!\nPlease check your configuration\n',[]} {error_logger,{{2001,1,9},{15,13,44}},crash_report,[[{pid,<0.16.0>},{registe red name,net_kernel},{error_info,{error,badarg}},{initial_call,{gen,init_it,[gen _se ver,<0.13.0>,<0.13.0>,{local,net_kernel},net_kernel,{vances,longnames,15000} ,[] }},{ancestors,[net_sup,kernel_sup,<0.8.0>]},{messages,[]},{links,[<0.13.0>]} ,{d ctionary,[{longnames,true}]},{trap_exit,true},{status,running},{heap_size,61 0}, stack_size,23},{reductions,169}],[]]} {error_logger,{{2001,1,9},{15,13,44}},supervisor_report,[{supervisor,{local, net sup}},{errorContext,start_error},{reason,{'EXIT',nodistribution}},{offender, [{p d,undefined},{name,net_kernel},{mfa,{net_kernel,start_link,[[vances,longname s]] },{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2001,1,9},{15,13,44}},supervisor_report,[{supervisor,{local, ker el_sup}},{errorContext,start_error},{reason,shutdown},{offender,[{pid,undefi ned ,{name,net_sup},{mfa,{erl_distribution,start_link,[]}},{restart_type,permane nt} {shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2001,1,9},{15,13,44}},crash_report,[[{pid,<0.7.0>},{register ed_ ame,[]},{error_info,{shutdown,{kernel,start,[normal,[]]}}},{initial_call,{ap pli ation_master,init,[<0.5.0>,<0.6.0>,{appl_data,kernel,[application_controller ,er _reply,auth,boot_server,code_server,disk_log_server,disk_log_sup,erl_prim_lo ade ,error_logger,file_server,fixtable_server,global_group,global_name_server,he art init,kernel_config,kernel_sup,net_kernel,net_sup,rex,user,os_server,ddll_ser ver erl_epmd,inet_db,pg2],undefined,{kernel,[]},[application,application_control ler application_master,application_starter,auth,code,code_aux,code_server,code_s erv r_int,dist_util,erl_boot_server,erl_distribution,erl_open_port,erl_prim_load er, rl_reply,erlang,error_handler,error_logger,file,global,global_group,global_s ear h,group,heart,inet6_tcp,inet6_tcp_dist,inet6_udp,inet_config,inet_hosts,inet _ge host_native,inet_tcp_dist,otp_pre_init,init,kernel,kernel_config,net,net_adm ,ne _kernel,os,ram_file,rpc,user,user_drv,user_sup,disk_log,disk_log_1,disk_log_ ser er,disk_log_sup,dist_ac,erl_atom_cache,erl_ddll,erl_epmd,erl_external,erts_d ebu ,fixtable_server,gen_tcp,gen_udp,prim_inet,inet,inet_db,inet_dns,inet_parse, ine _res,inet_tcp,inet_udp,pg2,seq_trace,socks5,socks5_auth,socks5_tcp,socks5_ud p,w ap_log_reader,otp_ring0],[],infinity,infinity},normal]}},{ancestors,[<0.6.0> ]}, messages,[{'EXIT',<0.8.0>,normal}]},{links,[<0.6.0>,<0.5.0>]},{dictionary,[] },{ rap_exit,true},{status,running},{heap_size,377},{stack_size,23},{reductions, 95} ,[]]} {error_logger,{{2001,1,9},{15,13,45}},std_info,[{application,kernel},{exited ,{s utdown,{kernel,start,[normal,[]]}}},{type,permanent}]} {'Kernel pid terminated',application_controller,shutdown} Abnormal termination From kent@REDACTED Wed Jan 10 00:08:48 2001 From: kent@REDACTED (Kent Boortz) Date: 10 Jan 2001 00:08:48 +0100 Subject: JInterface In-Reply-To: Sean Hinde's message of "Tue, 9 Jan 2001 19:37:05 -0000" References: <402DD461F109D411977E0008C791C312039F5C67@imp02mbx.one2one.co.uk> Message-ID: You can also use the old Jive application. Jive 1.3.2 was the last version before it was dropped. It is only Erlang and Java code so it should be portable. Versions prior to this had lots of problems but 1.3.2 one (included in patch erl_179) solved some (most?) of them. I may put Jive up at www.erlang.org as a contribution but it is not the recommended way of handling Java to C communication. kent From cesarini@REDACTED Wed Jan 10 10:31:47 2001 From: cesarini@REDACTED (Francesco Cesarini) Date: Wed, 10 Jan 2001 09:31:47 +0000 Subject: JInterface References: Message-ID: <3A5C2C03.42C1532F@terminus.ericsson.se> Vance Shipley wrote: > > Francesco Cesarini writes: > > Nope.. Does not work, as there are also changes and improvements in the > > Erlang distribution among releases, different versions of Erlang can not > > talk to each other (Unless of course, the distribution went untouched.. > > Which is definitively not the case between R5 and R7). > > Well that statement is a bit strong isn't it? Nothing harsh meant.. I ended up learning the hard way when trying to set up the distribution between a machine running Linux and one running VxWorks. We wasted a day believing we had a network problem.. Or a cable problem.. Or a hardware problem.. Or a configuration problem.. Or an installation problem.. Everything other than the fact that we where using two different Erlang versions. /FC -- Francesco Cesarini Erlang/OTP consultant Cellular: INT+44-7776 250381 ECN: 832-707192 http://welcome.to/cesarini.consulting From bjorn@REDACTED Wed Jan 10 10:52:16 2001 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 10 Jan 2001 10:52:16 +0100 Subject: JInterface In-Reply-To: "Vance Shipley"'s message of "Tue, 9 Jan 2001 15:06:05 -0500" References: Message-ID: In general, we only guarantee that two consectuitive major versions can talk to each other (i.e. R5 can talk to R6, R6 can talk to R7). We don't change the distribution protocol unless we have good reason; for instance the upcoming R8 *might* be able to talk R6 (so far we haven't found any reason to change the distribution protocol in R8). The original open-source version of Erlang (based on R4) could not talk with the commercial version of Erlang. All versions (commercial or open-source) of R6 and R7 can talk with each other. The commercial version of R6 can also talk with R5. (There was no open-source release of R5.) /Bj?rn "Vance Shipley" writes: > Francesco Cesarini writes: > > Nope.. Does not work, as there are also changes and improvements in the > > Erlang distribution among releases, different versions of Erlang can not > > talk to each other (Unless of course, the distribution went untouched.. > > Which is definitively not the case between R5 and R7). > > > Well that statement is a bit strong isn't it? I have connected my desktop > environment to other backend nodes running different versions. I would > also point out that the release notes have many mentions of certain _issues_ > involving ditribution between versions. I don't know about R5 <--> R7 > though. > > I was told at one point that my commercial versions wouldn't talk to the > opensource versions. Apparently this had to do with the security mechanisms > used in the commercial systems not being released as opensource. > > -Vance > -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From daniel.neri@REDACTED Wed Jan 10 12:02:14 2001 From: daniel.neri@REDACTED (Daniel Neri) Date: 10 Jan 2001 12:02:14 +0100 Subject: long names not working on Windows 2000 In-Reply-To: "Vance Shipley"'s message of "Tue, 9 Jan 2001 15:17:39 -0500" References: Message-ID: "Vance Shipley" writes: > Does this work for others? FWIW, it works for me on Win98. Try inet_db:gethostname() and inet_db:res_option(domain) in a shell (this is what net_kernel uses to construct the host part of a long node name). Regards, --Daniel -- Daniel Neri mailto:dn@REDACTED Sigicom AB, Sweden http://www.sigicom.com From Ciaran.Johnston@REDACTED Wed Jan 10 19:11:08 2001 From: Ciaran.Johnston@REDACTED (Ciaran Johnston) Date: Wed, 10 Jan 2001 18:11:08 +0000 Subject: JInterface References: Message-ID: <3A5CA5BB.5FC4A5D5@eei.ericsson.se> Thanks for all the answers to this question - we probably missed out on a lot of pain and anquish as a result. We decided to go with an upgrade to R7B and we have got some simple communication going (trying to communicate with R5B was a non-starter). Thanks and regards, Ciaran. From vances@REDACTED Thu Jan 11 03:04:00 2001 From: vances@REDACTED (Vance Shipley) Date: Wed, 10 Jan 2001 21:04:00 -0500 Subject: long names not working on Windows 2000 In-Reply-To: Message-ID: > Try inet_db:gethostname() and inet_db:res_option(domain) in a shell > (this is what net_kernel uses to construct the host part of a long node name). Eshell V5.0.1 (abort with ^G) (vances@REDACTED)1> inet_db:gethostname(). "desk" (vances@REDACTED)2> inet_db:res_option(domain). [] Yet in a DOS shell I can do something like: C:\> ping mail Pinging mail.motivity.ca [192.197.189.1] with 32 bytes of data: Reply from 192.197.189.1: bytes=32 time<10ms TTL=64 Reply from 192.197.189.1: bytes=32 time<10ms TTL=64 Ping statistics for 192.197.189.1: Packets: Sent = 2, Received = 2, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms From dg@REDACTED Thu Jan 11 05:29:48 2001 From: dg@REDACTED (David Gould) Date: Wed, 10 Jan 2001 20:29:48 -0800 Subject: long names not working on Windows 2000 In-Reply-To: ; from vances@motivity.ca on Wed, Jan 10, 2001 at 09:04:00PM -0500 References: Message-ID: <20010110202948.C11631@archimedes.oak.suse.com> On Wed, Jan 10, 2001 at 09:04:00PM -0500, Vance Shipley wrote: > > Try inet_db:gethostname() and inet_db:res_option(domain) in a shell > > (this is what net_kernel uses to construct the host part of a long node > name). > > Eshell V5.0.1 (abort with ^G) > > (vances@REDACTED)1> inet_db:gethostname(). > "desk" This means that the current host has the name "desk". > (vances@REDACTED)2> inet_db:res_option(domain). > [] This means that the current host does not have a domain. > C:\> ping mail > Pinging mail.motivity.ca [192.197.189.1] with 32 bytes of data: This means that "mail" is a host named mail in the domain "motivity.ca". ping can find it because your DNS or hosts file has an alias for mail to mail.motivity.ca, or that your resolver is configured to search domain "motivity.ca" when queried with just a host name. However host "mail" has nothing to do with host "desk". What host "mail" needs is to be configured to be part of some domain. -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! i'm the thief of nihilism! i'm the new god of zen monks." From raimo@REDACTED Thu Jan 11 08:46:05 2001 From: raimo@REDACTED (Raimo Niskanen) Date: Thu, 11 Jan 2001 08:46:05 +0100 Subject: long names not working on Windows 2000 References: , , <20010110202948.C11631@archimedes.oak.suse.com> Message-ID: <3A5D64BD.7F3B7F4D@erix.ericsson.se> Unfortunately, I am not familiar to Windows 2000, but i can give you some info about how it is supposed to work on Windows NT. Since Windows 2000 is not explicitly handled by Erlang, it regards the OS to be NT or other Windows. You can try "os:type()" to see which. Erlang reads the domain from the registry, where the TCP/IP protocol stack should have put the information. You can try regedit (on NT) and find the key: \HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\Domain which should contain the domain name. On other Windows it is supposed to be: \HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Vxd\Mstcp\Domain For this key to be present, the TCP/IP protocol stack must be correctly configured. Find the icon "Network Neighbourhood", right click -> "Properties" -> "Protocols" -> "TCP/IP" -> "Properties" -> "DNS" check the box "Domain". Also check the level in parallel to "DNS" called "IP Address" to be fixed address. I hope this can put you on the track of the problem. / Raimo Niskanen, Ericsson UAB, Erlang/OTP David Gould wrote: > > On Wed, Jan 10, 2001 at 09:04:00PM -0500, Vance Shipley wrote: > > > Try inet_db:gethostname() and inet_db:res_option(domain) in a shell > > > (this is what net_kernel uses to construct the host part of a long node > > name). > > > > Eshell V5.0.1 (abort with ^G) > > > > (vances@REDACTED)1> inet_db:gethostname(). > > "desk" > > This means that the current host has the name "desk". > > > > (vances@REDACTED)2> inet_db:res_option(domain). > > [] > > This means that the current host does not have a domain. > > > > C:\> ping mail > > Pinging mail.motivity.ca [192.197.189.1] with 32 bytes of data: > > This means that "mail" is a host named mail in the domain "motivity.ca". > ping can find it because your DNS or hosts file has an alias for > mail to mail.motivity.ca, or that your resolver is configured to search > domain "motivity.ca" when queried with just a host name. > > However host "mail" has nothing to do with host "desk". > > What host "mail" needs is to be configured to be part of some domain. > > -dg > > -- > David Gould dg@REDACTED > SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 > why would you want to own /dev/null? "ooo! ooo! look! i stole nothing! > i'm the thief of nihilism! i'm the new god of zen monks." From vances@REDACTED Thu Jan 11 09:22:24 2001 From: vances@REDACTED (Vance Shipley) Date: Thu, 11 Jan 2001 03:22:24 -0500 Subject: long names not working on Windows 2000 In-Reply-To: <3A5D64BD.7F3B7F4D@erix.ericsson.se> Message-ID: Raimo Niskanen wries: > Since Windows 2000 is not explicitly handled by Erlang, it regards > the OS to be NT or other Windows. You can try "os:type()" to see which. Here it's: {win32,nt} > Erlang reads the domain from the registry, where the TCP/IP protocol > stack should have put the information. You can try regedit (on NT) and > find the key: > > \HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\Domai n > which should contain the domain name. This was blank here. There were a number of other places where it was defined correctly. I believe that with Windows 2000 it seperates things more by "controllers" (i.e. LAN adaptors). I manually edited with regedit and low and behold it now works. Thanks, -Vance From daniel.neri@REDACTED Thu Jan 11 09:39:02 2001 From: daniel.neri@REDACTED (Daniel Neri) Date: 11 Jan 2001 09:39:02 +0100 Subject: long names not working on Windows 2000 In-Reply-To: David Gould's message of "Wed, 10 Jan 2001 20:29:48 -0800" References: <20010110202948.C11631@archimedes.oak.suse.com> Message-ID: David Gould writes: > On Wed, Jan 10, 2001 at 09:04:00PM -0500, Vance Shipley wrote: > > (vances@REDACTED)2> inet_db:res_option(domain). > > [] > > This means that the current host does not have a domain. It also means that net_kernel will be unable to create a valid long node name, i.e. one whose host part is a fully qualified domain name. Regards, --Daniel -- Daniel Neri mailto:dn@REDACTED Sigicom AB, Sweden http://www.sigicom.com From vances@REDACTED Fri Jan 12 07:13:08 2001 From: vances@REDACTED (Vance Shipley) Date: Fri, 12 Jan 2001 01:13:08 -0500 Subject: erlc options Message-ID: How do you get the MIB compiler to accept -ilroot? I've tried every combination of things I keep getting this: erlc +"{db,mnesia}" -ilroot "eva/priv/mibs/" ASG-MIB.mib ASG-MIB.mib: 14: Error: Could not import [{node,currentAlarmObject}, {node,currentAlarmSeverity}, {node,currentAlarmTime}] from mib OTP-EVA-MIB.bin. File not found. Check that the MIB to be IMPORTED is compiled and present in the import path. compilation_failedmake: *** [ASG-MIB.bin] Error 1 -Vance From mbj@REDACTED Fri Jan 12 08:31:54 2001 From: mbj@REDACTED (Martin Bjorklund) Date: Fri, 12 Jan 2001 08:31:54 +0100 Subject: erlc options In-Reply-To: Your message of "Fri, 12 Jan 2001 01:13:08 -0500" References: Message-ID: <20010112083154T.mbj@bluetail.com> "Vance Shipley" wrote: > > How do you get the MIB compiler to accept -ilroot? I think you want to use the -I option, not -ilroot. With -I you add a specific directory to the include/import path. -ilroot is used for erlang code which uses the directive -include_lib. > I've tried every combination of things I keep getting this: > > erlc +"{db,mnesia}" -ilroot "eva/priv/mibs/" ASG-MIB.mib So try: erlc +"{db,mnesia}" -I "eva/priv/mibs/" ASG-MIB.mib instead. /martin From spearce@REDACTED Sat Jan 13 05:51:25 2001 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 12 Jan 2001 23:51:25 -0500 Subject: resolv.conf Message-ID: <20010112235125.H6819@spearce.org> I discovered that the following resolve.conf does not work for an erlang node and will cause all namserver lookups to fail because there are no nameservers registered in the node: search cs.rpi.edu rpi.edu nameserver 128.113.18.1 ns.cs.rpi.edu But the following does work: search cs.rpi.edu rpi.edu nameserver 128.113.18.1 What was really interesting was that no other application was having problems with DNS services EXCEPT for Erlang. This is release R7B. You guys might want to add this to the FAQ about getting a distributed Erlang to work. BTW, that JInterface is great. :-) Thanks. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From vances@REDACTED Sat Jan 13 04:52:01 2001 From: vances@REDACTED (Vance Shipley) Date: Fri, 12 Jan 2001 22:52:01 -0500 Subject: erlc options In-Reply-To: Message-ID: I think there may be something broken here. I can compile the Erlang way: Eshell V5.0.1.1 (abort with ^G) 1> snmp:c("ASG-MIB", [{db, mnesia}, {il, ["eva/priv/mibs"]}]). {ok,"./ASG-MIB.bin"} But I can't get it to work the Unix way: $ make erlc +'{db,mnesia}' -ilroot '["eva/priv/mibs/]"' ASG-MIB.mib ASG-MIB.mib: 14: Error: Could not import [{node,currentAlarmObject}, {node,currentAlarmSeverity}, {node,currentAlarmTime}] from mib OTP-EVA-MIB.bin. File not found. Check that the MIB to be IMPORTED is compiled and present in the import path. compilation_failedmake: *** [ASG-MIB.bin] Error 1 The syntax above seems to be what what is suggested by the documentation. I have also tried the following: erlc -ilroot 'eva/priv/mibs/' ASG-MIB.mib erlc -ilroot "eva/priv/mibs/" ASG-MIB.mib erlc -ilroot eva/priv/mibs/ ASG-MIB.mib erlc -ilroot [eva/priv/mibs/] ASG-MIB.mib erlc -ilroot "[eva/priv/mibs/]" ASG-MIB.mib erlc -ilroot '["/usr/local/lib/erlang/lib/eva-2.0.2.1/priv/mibs/"]' ASG-MIB.mib erlc -I '["eva/priv/mibs/]"' ASG-MIB.mib Hoever this does work: $ cp /usr/local/lib/erlang/lib/eva-2.0.2.1/priv/mibs/OTP-EVA-MIB.bin . $ make erlc +'{db,mnesia}' -ilroot '["eva/priv/mibs/]"' ASG-MIB.mib I give up! -Vance From icsm2001@REDACTED Sat Jan 13 06:19:04 2001 From: icsm2001@REDACTED (icsm2001 (NESI)) Date: Sat, 13 Jan 2001 06:19:04 +0100 (MET) Subject: IEEE Conference Software Maint. Italy,Florence, ICSM2001 Message-ID: <200101130519.GAA22238@dsiI.dsi.unifi.it> Dear Colleague I would like to invite you to propose papers, experiences, tutorials, tool expositions, dissertations at the IEEE International Conference on Software Maintenance, 2001, and workshops: SCAM, WESS, WSE and TABOO, etc., November 2001, Florence, Italy. ICSM is the major international conference in the field of software and systems maintenance, evolution, management, software metrics and quality, etc. Outstanding Keynotes such as: >->->Prof. David Lorge Parnas, Prof. Dieter Rombach, Prof. Ivar Jacobson<-<-<- Awards, workshops, panels, and other exciting activities have been planned. Please note in the following the new deadline that has been moved to satisfy the several requests recevied, next deadline >->->->-29 January 2001<-<-<-<-<-<- Please forward this remind to anybody who you think may be interested. Apologies if you have already seen this. If you would like to be removed from our list please send an email to icsm2001@REDACTED with REMOVE in the subject. ICSM2001 Paolo Nesi (General Chair) _=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_= >->->CALL---FOR---PAPERs<-<-< IEEE International Conference on Software Maintenance 2001 FLORENCE, ITALY, 6-10 November 2001 http://www.dsi.unifi.it/icsm2001 Theme: Systems and Software Evolution in the era of the Internet IMPORTANT DATES, DEADLINES Research Paper submission 29 January 2001 Dissertation submission 29 January 2001 Industrial Application submission 12 March 2001 Tools request and submission 12 March 2001 Tutorial submission 12 February 2001 _=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_= From vances@REDACTED Sat Jan 13 18:28:22 2001 From: vances@REDACTED (Vance Shipley) Date: Sat, 13 Jan 2001 12:28:22 -0500 Subject: erlc options In-Reply-To: Message-ID: > erlc +'{db,mnesia}' -ilroot '["eva/priv/mibs/]"' ASG-MIB.mib > > The syntax above seems to be what what is suggested by the documentation. Oops, typo above. It should be: erlc +'{db,mnesia}' -ilroot '["eva/priv/mibs/"]' ASG-MIB.mib However the typo was only in the email. I wish it were that easy. :) -Vance From vances@REDACTED Sun Jan 14 06:31:03 2001 From: vances@REDACTED (Vance Shipley) Date: Sun, 14 Jan 2001 00:31:03 -0500 Subject: time values Message-ID: I've come to realize that, despite anything which may appear in the documentation to the contrary, time values in Erlang/OTP are always in milliseconds. I naively believed the man page for the .app file: ... {maxT, Seconds | infinity}, ... And my application ran for 15 minutes instead of 10 days. :) -Vance From vladdu@REDACTED Sun Jan 14 17:26:37 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Sun, 14 Jan 2001 17:26:37 +0100 Subject: Self-modifying code Message-ID: Hi all! As an interesting project, I was thinking about converting some of my old applications from Lisp to Erlang. It should be interesting and not extremely difficult. However, there is one thing that I don't know how to handle: in Lisp it is very easy to dynamically build a list and then evaluate it as a program. Is there a way to do something like that with Erlang? One simple solution would be to write a Lisp-like interpreter in Erlang, and use regular lists to build and to evaluate. But much cooler it would be to have an Erlang interpreter instead! Btw, how could one write lists as in Lisp, without commas between items? Parse transformations need proper Erlang code as input, don't they? regards, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From vladdu@REDACTED Sun Jan 14 23:05:36 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Sun, 14 Jan 2001 23:05:36 +0100 Subject: Self-modifying code Message-ID: Hi again. I have to specify my question a bit: I know about the erl_eval module, what I wanted is a _compiled_ version of the code, and a way to "uncompile" it. thanks, Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From dne@REDACTED Mon Jan 15 01:27:51 2001 From: dne@REDACTED (Daniel Neri) Date: 15 Jan 2001 01:27:51 +0100 Subject: resolv.conf In-Reply-To: Shawn Pearce's message of "Fri, 12 Jan 2001 23:51:25 -0500" References: <20010112235125.H6819@spearce.org> Message-ID: <87wvbxk6bc.fsf@nowhere.mayonnaise.net> Shawn Pearce writes: > I discovered that the following resolve.conf does not work for an > erlang node and will cause all namserver lookups to fail because there > are no nameservers registered in the node: > > search cs.rpi.edu rpi.edu > nameserver 128.113.18.1 ns.cs.rpi.edu At least according to the resolv.conf manpage on my BSD system, that second line is not valid -- you need to use plain IP addresses. What does your manual page say? Regards, --Daniel -- Daniel Neri dne@REDACTED From spearce@REDACTED Mon Jan 15 01:41:02 2001 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jan 2001 19:41:02 -0500 Subject: resolv.conf In-Reply-To: <87wvbxk6bc.fsf@nowhere.mayonnaise.net>; from dne@mayonnaise.net on Mon, Jan 15, 2001 at 01:27:51AM +0100 References: <20010112235125.H6819@spearce.org> <87wvbxk6bc.fsf@nowhere.mayonnaise.net> Message-ID: <20010114194102.K6819@spearce.org> Daniel Neri scrawled: > Shawn Pearce writes: > > > I discovered that the following resolve.conf does not work for an > > erlang node and will cause all namserver lookups to fail because there > > are no nameservers registered in the node: > > > > search cs.rpi.edu rpi.edu > > nameserver 128.113.18.1 ns.cs.rpi.edu > > At least according to the resolv.conf manpage on my BSD system, that > second line is not valid -- you need to use plain IP addresses. What > does your manual page say? I'm using RedHat Linux 6.2. (I know, first mistake is using Linux.) Apparently, my manual page does not exist for resolve.conf(5). However, resolver(5), taken right from the BIND distribution says nothing of this syntax. Regardless of it being valid or not, my line quoted above works just fine for every application on RedHat Linux (at least version 6.2) except Erlang. (Hence the post to this list.) Now since my file was broken, I fixed it, but I thought that since I wasted 8 hours looking for this problem I might at least let others know about it and maybe save them the time of discovering that their resolv.conf is also ``broken''. Perhaps a more liberal parser may be in order in Erlang's inet library as almost everything else on Linux seems to ignore the name of the nameserver on the nameserver line. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From dne@REDACTED Mon Jan 15 02:07:51 2001 From: dne@REDACTED (Daniel Neri) Date: 15 Jan 2001 02:07:51 +0100 Subject: resolv.conf In-Reply-To: Shawn Pearce's message of "Sun, 14 Jan 2001 19:41:02 -0500" References: <20010112235125.H6819@spearce.org> <87wvbxk6bc.fsf@nowhere.mayonnaise.net> <20010114194102.K6819@spearce.org> Message-ID: <871yu5k4go.fsf@nowhere.mayonnaise.net> Shawn Pearce writes: > Apparently, my manual page does not exist for resolve.conf(5). A common Linux (distribution) problem, I guess. See http://www.isc.org/products/BIND/docs/bog-4.9.4/bog-sh-5.html#sh-5.2 (possibly a bit out of date.) > Now since my file was broken, I fixed it, but I thought that since I > wasted 8 hours looking for this problem I might at least let others > know about it and maybe save them the time of discovering that their > resolv.conf is also ``broken''. Of course. And the Erlang resolv.conf parser should've barfed with a sensible error message. Regards, --Daniel -- Daniel Neri dne@REDACTED From spearce@REDACTED Mon Jan 15 02:10:59 2001 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jan 2001 20:10:59 -0500 Subject: resolv.conf In-Reply-To: <871yu5k4go.fsf@nowhere.mayonnaise.net>; from dne@mayonnaise.net on Mon, Jan 15, 2001 at 02:07:51AM +0100 References: <20010112235125.H6819@spearce.org> <87wvbxk6bc.fsf@nowhere.mayonnaise.net> <20010114194102.K6819@spearce.org> <871yu5k4go.fsf@nowhere.mayonnaise.net> Message-ID: <20010114201059.L6819@spearce.org> Daniel Neri scrawled: > Shawn Pearce writes: > > > Apparently, my manual page does not exist for resolve.conf(5). > > A common Linux (distribution) problem, I guess. See > > http://www.isc.org/products/BIND/docs/bog-4.9.4/bog-sh-5.html#sh-5.2 > > (possibly a bit out of date.) > > > Now since my file was broken, I fixed it, but I thought that since I > > wasted 8 hours looking for this problem I might at least let others > > know about it and maybe save them the time of discovering that their > > resolv.conf is also ``broken''. > > Of course. And the Erlang resolv.conf parser should've barfed with a > sensible error message. You mean rather than assuming there are no nameservers known in the world, and therefore always return false for any DNS lookup except "localhost" (thanks to /etc/hosts)?? -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From spearce@REDACTED Mon Jan 15 05:32:43 2001 From: spearce@REDACTED (Shawn Pearce) Date: Sun, 14 Jan 2001 23:32:43 -0500 Subject: TCL in Erlang Message-ID: <20010114233243.N6819@spearce.org> In a sick, perverted way I want to embed a TCL runtime in the Erlang VM so I can call TCL code from Erlang. Or really, let Erlang define a set of functions which the TCL engine will invoke when the Erlang code asked the TCL engine to execute a source file. What I have in mind is something like this: test(FilePath) -> I = tcl:create(), tcl:register(I, "ExecuteErlang", ?MODULE, execute, undefined), tcl:eval(I, FilePath). execute(Handle, CmdName, [UserName, Email | Message]) -> io:format("User ~p asked me to email them ~p at ~p~n.", [UserName, Message, Email]). Or something like that. Should I make a driver that will link against the TCL library and can be loaded, or should I make the TCL engine an external process, fork it and connect it with a TCP stream? Or could I make the tcl module a set of BIFs somehow that would make it unnecessary to define a protocol... Or since I wanted TCL soley for its syntax, am I just better off making my own language parser in Erlang and using that process the input file? -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From martin@REDACTED Mon Jan 15 20:53:37 2001 From: martin@REDACTED (Charles Martin) Date: Mon, 15 Jan 2001 11:53:37 -0800 Subject: Distributed Erlang Security Message-ID: <5.0.0.25.0.20010115114855.0205beb0@chasm.org> Are there any provisions for code security in Erlang? To make this question concrete, suppose I implemented a Gnutella-like system in Erlang. Every user now runs an Erlang node. Suppose one of the users is malicious; could they execute arbitrary code on the other user's machines? Is there any way to use Erlang with untrusted users? Charles From Lon.Willett@REDACTED Mon Jan 15 22:16:46 2001 From: Lon.Willett@REDACTED (Lon Willett) Date: Mon, 15 Jan 2001 21:16:46 +0000 Subject: Distributed Erlang Security In-Reply-To: <5.0.0.25.0.20010115114855.0205beb0@chasm.org> Message-ID: <5.0.2.1.0.20010115205350.04c0b4e0@emile.sse.ie> Hi, At 19:53 15/01/01, Charles Martin wrote: >Are there any provisions for code security in Erlang? To make this question concrete, suppose I implemented a Gnutella-like system in Erlang. Every user now runs an Erlang node. Suppose one of the users is malicious; could they execute arbitrary code on the other user's machines? Is there any way to use Erlang with untrusted users? > >Charles In brief: no, yes, and no. Currently, Erlang/OTP has very little built-in security of any sort. I'm trying to put together a basic method of securing the communications layer at the moment, but this still wouldn't answer your needs. What you want is the Safe Erlang project (http://www.ericsson.se/cslab/~dan/proj/safeerlang). But I don't think that it is ready to fly yet, and you're likely to run into some other limitations of OTP for this type of application. So you're pretty much stuck with using TCP or UDP sockets and defining the protocol yourself. Note however that term_to_binary and binary_to_term can be very handy when you're willing to stick to strictly Erlang implementations of your protocol. In that case, it's not _too_ painful to implement, despite not being as convenient as using the built-in communication facility. /Lon From vladdu@REDACTED Mon Jan 15 23:50:16 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Mon, 15 Jan 2001 23:50:16 +0100 Subject: Abstract forms Message-ID: Hi again... I have been playing a lot with code, erl_parse, beam_lib and the likes, and things go pretty well. There is one thing that I can't do and I'd like to: obtain an abstract form for a function, compile it and run it. Obtaining isn't a problem now, but trying to compile it fails miserabily... Is it the right abstract form format that is returned from beam_lib:chunks(abstract_form) that can be fed into compile:forms? thanks. Vlad -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardc@REDACTED Tue Jan 16 10:10:44 2001 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 16 Jan 2001 10:10:44 +0100 (MET) Subject: Abstract forms In-Reply-To: Message-ID: On Mon, 15 Jan 2001, Vlad Dumitrescu wrote: > I have been playing a lot with code, erl_parse, beam_lib and the > likes, and things go pretty well. There is one thing that I can't do > and I'd like to: obtain an abstract form for a function, compile it > and run it. Obtaining isn't a problem now, but trying to compile it > fails miserabily... > > Is it the right abstract form format that is returned from > beam_lib:chunks(abstract_form) that can be fed into compile:forms? The result from beam_lib:chunks(File, [abstract_code]) is indeed (at least currently) on basically the same format as that returned from erl_parse. (It has been expanded by the compiler, so you won't find records or function imports in that code. Look in sys_pre_expand for details.) It could be fed into compile:forms, but you'd have to modify it a bit first: - add a module declaration form at the top of the list: {attribute,Line,module,ModuleName} - remove the auto-generated code for "module_info" functions: {function,Line,module_info,0,Clauses} {function,Line,module_info,1,Clauses} but keep in mind that the compiler only accepts complete modules as input, even if you use compile:forms. /Richard Carlsson Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ From daniel.neri@REDACTED Tue Jan 16 10:24:04 2001 From: daniel.neri@REDACTED (Daniel Neri) Date: 16 Jan 2001 10:24:04 +0100 Subject: [Jakob Cederlund=?iso-8859-1?q?_p=E5?= UAB ] Re: long names not working on Windows 2000 Message-ID: I'm guessing this was meant for the list... --Daniel -------------- next part -------------- An embedded message was scrubbed... From: Jakob Cederlund p? UAB Subject: Re: long names not working on Windows 2000 Date: Tue, 16 Jan 2001 10:03:12 +0100 Size: 2156 URL: -------------- next part -------------- -- Daniel Neri mailto:dn@REDACTED Sigicom AB, Sweden http://www.sigicom.com From cesarini@REDACTED Tue Jan 16 10:48:39 2001 From: cesarini@REDACTED (Francesco Cesarini) Date: Tue, 16 Jan 2001 09:48:39 +0000 Subject: Distributed Erlang Security References: <5.0.0.25.0.20010115114855.0205beb0@chasm.org> Message-ID: <3A6418F7.CA79B1B1@terminus.ericsson.se> Have you looked at the net kernel? It is an Erlang process which coordinates operations in a distributed Erlang Node. Bifs dealing with distribution (such as spawn) are converted into messages on the originating node and sent to the net kernel on its peer. It will also handle authentication and reject or accept messages. You can change the net kernel with a user defined process and do things such as * change the authentication scheme * allow messages to be sent only to a specific registered process * Block spawning of processes, * etc. etc. There are probably many issues I have not covered, but hopefully the above should get you going in the right track. Regards, Francesco Charles Martin wrote: > > Are there any provisions for code security in Erlang? To make this > question concrete, suppose I implemented a Gnutella-like system in > Erlang. Every user now runs an Erlang node. Suppose one of the users is > malicious; could they execute arbitrary code on the other user's > machines? Is there any way to use Erlang with untrusted users? > > Charles -- Francesco Cesarini Erlang/OTP consultant Cellular: INT+44-7776 250381 ECN: 832-707192 http://welcome.to/cesarini.consulting From vladdu@REDACTED Tue Jan 16 11:08:44 2001 From: vladdu@REDACTED (Vlad Dumitrescu) Date: Tue, 16 Jan 2001 11:08:44 +0100 Subject: Abstract forms Message-ID: > > I have been playing a lot with code, erl_parse, beam_lib and the > > likes, and things go pretty well. >It could be fed into compile:forms, but you'd have to modify it a bit >first: > - add a module declaration form at the top of the list: > {attribute,Line,module,ModuleName} > - remove the auto-generated code for "module_info" functions: > {function,Line,module_info,0,Clauses} > {function,Line,module_info,1,Clauses} Thanks. I had managed to work it out myself, and it works now. However, there is a problem: if I try to compile a function with guards, I get an error from the compiler saying "illegal guard expression". It works fine to compile it as usual... Any idea why? Then there is a more general observation: it's not at all easy to navigate the abstract forms in order to make changes... compared to Lisp, anyway, because there everything is a list, here the structure is heterogenous... regards, Vlad _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. From richardc@REDACTED Tue Jan 16 11:40:53 2001 From: richardc@REDACTED (Richard Carlsson) Date: Tue, 16 Jan 2001 11:40:53 +0100 (MET) Subject: Abstract forms In-Reply-To: Message-ID: On Tue, 16 Jan 2001, Vlad Dumitrescu wrote: > However, there is a problem: if I try to compile a function with guards, I > get an error from the compiler saying "illegal guard expression". It works > fine to compile it as usual... Any idea why? Not sure. Do you mean guards that you have constructed yourself, or guards as found in the beam file? > Then there is a more general observation: it's not at all easy to > navigate the abstract forms in order to make changes... compared to > Lisp, anyway, because there everything is a list, here the structure > is heterogenous... Yes, that's a big bother. You could look at my syntax_tools package under http://www.erlang.org/user.html - it makes the "abstract form" look like a homogeneous syntax tree structure. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://www.csd.uu.se/~richardc/ From garry@REDACTED Tue Jan 16 17:33:35 2001 From: garry@REDACTED (Garry Hodgson) Date: Tue, 16 Jan 2001 11:33:35 -0500 Subject: dynamically linked drivers Message-ID: <3A6477DF.854CB608@sage.att.com> reading the erlang book on ports and drivers last night, it appears that i must hand-compile a version of erlang with my new driver linked in, after editing config.c to reference it. is this still accurate? it doesn't seem a very useful way to go, in an environment where i'd like to use erlang to control various other software. should i abandon this method, and go with the other external port methods? -- Garry Hodgson Once in a while Senior Hacker you can get shown the light Software Innovation Services in the strangest of places AT&T Labs if you look at it right From etxuwig@REDACTED Tue Jan 16 17:52:56 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 16 Jan 2001 17:52:56 +0100 (MET) Subject: dynamically linked drivers In-Reply-To: <3A6477DF.854CB608@sage.att.com> Message-ID: On Tue, 16 Jan 2001, Garry Hodgson wrote: >reading the erlang book on ports and drivers last night, >it appears that i must hand-compile a version of erlang >with my new driver linked in, after editing config.c to >reference it. is this still accurate? it doesn't seem >a very useful way to go, in an environment where i'd like >to use erlang to control various other software. should >i abandon this method, and go with the other external >port methods? No, you don't have to recompile Erlang to link in a driver. The documentation on drivers hasn't really kept up with current events. Read the manual for the module erl_ddll for information on how to dynamically link drivers into an Erlang system. You might also want to read the ERTS User's Guide in the OTP R7B manual. There is a chapter on the driver for distributed erlang, and it talks a little about drivers in general. Still, if you can do with a normal port, you can save yourself the headache of debugging pointer errors in your own driver code. If, for performance reasons, you need your own driver, you can start with a normal port, and add your own driver later, with minimal changes to the erlang code. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From garry@REDACTED Tue Jan 16 18:05:14 2001 From: garry@REDACTED (Garry Hodgson) Date: Tue, 16 Jan 2001 12:05:14 -0500 Subject: dynamically linked drivers References: Message-ID: <3A647F4A.7E8C9863@sage.att.com> Ulf Wiger wrote: > No, you don't have to recompile Erlang to link in a driver. > The documentation on drivers hasn't really kept up with current > events. wonderful. i'd kind of figured this was the case, given how well thought out the rest of erlang is. > Still, if you can do with a normal port, you can save yourself the > headache of debugging pointer errors in your own driver code. bugs? in *my* code? not bloody likely! :-) thanks very much for the rapid and helpful response. i'm looking forward to using this. i've been looking for an excuse to use erlang for some time now. -- Garry Hodgson Once in a while Senior Hacker you can get shown the light Software Innovation Services in the strangest of places AT&T Labs if you look at it right From raimo@REDACTED Wed Jan 17 13:31:52 2001 From: raimo@REDACTED (Raimo Niskanen) Date: Wed, 17 Jan 2001 13:31:52 +0100 Subject: lists:partition/2 Message-ID: <3A6590B8.2022B0AF@erix.ericsson.se> Hello, I am missing function in the module lists, one that using a predicate partitions a list into two; one with all elements for which the predicate was true, and one for the rest, while preserving the ordering of the elements. It could be defined as follows: partition(Pred, List) -> partition(Pred, List, [], []). partition(Pred, [], ListTrue, ListFalse) -> {reverse(ListTrue), reverse(ListFalse)}; partition(Pred, [H | T], ListTrue, ListFalse) -> case Pred(H) of true -> partition(Pred, T, [H | ListTrue], ListFalse); false -> partition(Pred, T, ListTrue, [H | ListFalse]) end. This could be accomplished with lists:foldr/3 like this: partition(Pred, List) -> foldr( fun(Element, {ListTrue, ListFalse}) -> case Pred(Element) of true -> {[Element | ListTrue], ListFalse}; false -> {ListTrue, [Element | ListFalse]} end end, {[], []}, List). The latter one is unfortunately not tail recursive, and it is less efficient because it assembles / disassembles a tuple in each loop recursion. The questions are: is partition/2 sucha a useful function that it is worthy of being included in the lists module, and are there any comments on the implementation? / Raimo Niskanen, Ericsson UAB, Erlang/OTP. From mbj@REDACTED Wed Jan 17 13:47:53 2001 From: mbj@REDACTED (Martin Bjorklund) Date: Wed, 17 Jan 2001 13:47:53 +0100 Subject: lists:partition/2 In-Reply-To: Your message of "Wed, 17 Jan 2001 13:31:52 +0100" <3A6590B8.2022B0AF@erix.ericsson.se> References: <3A6590B8.2022B0AF@erix.ericsson.se> Message-ID: <20010117134753A.mbj@bluetail.com> Raimo Niskanen wrote: > Hello, > > I am missing function in the module lists, one that using a predicate > partitions a list into two; one with all elements for which the > predicate was true, and one for the rest, while preserving the ordering > of the elements. > The questions are: is partition/2 sucha a useful function that it is > worthy of being included in the lists module, yes, definitely! i've (re)implemented it many times... > and are there any comments on the implementation? use the first one. also, maybe you could add a function that doesn't preserve the order. /martin From luke@REDACTED Wed Jan 17 14:53:13 2001 From: luke@REDACTED (Luke Gorrie) Date: 17 Jan 2001 14:53:13 +0100 Subject: lists:partition/2 In-Reply-To: Raimo Niskanen's message of "Wed, 17 Jan 2001 13:31:52 +0100" References: <3A6590B8.2022B0AF@erix.ericsson.se> Message-ID: Raimo Niskanen writes: > Hello, > > I am missing function in the module lists, one that using a predicate > partitions a list into two; one with all elements for which the > predicate was true, and one for the rest, while preserving the ordering > of the elements. Yes yes! And here are a few other functions I've written lots of times: %% For 'lists' %% separate(X, L): %% Separate the elements of the list L by placing X between them. %% e.g.: lists:flatten(separate(", ", ["foo", "bar", "baz"])) %% => "foo, bar, baz" separate(X, []) -> []; separate(X, [H]) -> [H]; separate(X, [H|T]) -> [H,X|separate(X, T)]. %% For 'lists' %% first(Pred, List) %% Find the first element of List satisfying Pred. %% Returns: {value, Item} | false first(Pred, []) -> false; first(Pred, [H|T]) -> case Pred(H) of true -> {value, H}; false -> first(Pred, T) end. %% For 'io_lib' %% Very simple, but it's amazing how often %% lists:flatten(io_lib:format(..)) makes me go over the 80-column %% boundry :) flatformat(Fmt, Args) -> lists:flatten(io_lib:format(Fmt, Args)). I know that you can do the 'first' with 'dropwhile' and so on, but I'd still like to have these :-) P.S. it's very nice that the latest erlang's lists:sort can take a predicate! Cheers, Luke From daniel.neri@REDACTED Wed Jan 17 15:43:31 2001 From: daniel.neri@REDACTED (Daniel Neri) Date: 17 Jan 2001 15:43:31 +0100 Subject: lists:partition/2 In-Reply-To: Luke Gorrie's message of "17 Jan 2001 14:53:13 +0100" References: <3A6590B8.2022B0AF@erix.ericsson.se> Message-ID: Luke Gorrie writes: > %% separate(X, L): > %% Separate the elements of the list L by placing X between them. This one is called `intersperse' in the Haskell library, which could maybe also serve as inspiration for other additions to the lists module: http://www.haskell.org/onlinelibrary/list.html Regards, ---Daniel PS. BTW, could we please drop the plural `s' from `lists', `sets' and `ordsets'? -- Daniel Neri mailto:dn@REDACTED Sigicom AB, Sweden http://www.sigicom.com From Jouni.Ryno@REDACTED Wed Jan 17 15:52:50 2001 From: Jouni.Ryno@REDACTED (Jouni.Ryno@REDACTED) Date: Wed, 17 Jan 2001 16:52:50 +0200 Subject: Wishes: hex-output, was: lists:partition/2 In-Reply-To: Message from Luke Gorrie of "17 Jan 2001 14:53:13 +0100." Message-ID: If it's going to be late Christmas season, and one could make some wishes, what about hex-output for io:format Unfortunately there should be several of them for { CAFE, 0xCAFE, 16#CAFE and ... ? } Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ http://www.geo.fmi.fi/~ryno/ Finnish Meteorological Institute http://www.fmi.fi/ Geophysical Research http://www.geo.fmi.fi/ P.O.BOX 503 Tel (+358)-9-19294656 FIN-00101 Helsinki GSM (+358)-50-5302903 Finland FAX (+358)-9-19294603 "It's just zeros and ones, it cannot be hard" From sam@REDACTED Wed Jan 17 16:02:31 2001 From: sam@REDACTED (Samuel Tardieu) Date: Wed, 17 Jan 2001 16:02:31 +0100 Subject: lists:partition/2 In-Reply-To: ; from daniel.neri@sigicom.com on Wed, Jan 17, 2001 at 03:43:31PM +0100 References: <3A6590B8.2022B0AF@erix.ericsson.se> Message-ID: <2001-01-17-16-02-32+trackit+sam@inf.enst.fr> On 17/01, Daniel Neri wrote: | Luke Gorrie writes: | | > %% separate(X, L): | > %% Separate the elements of the list L by placing X between them. | | This one is called `intersperse' in the Haskell library, which could | maybe also serve as inspiration for other additions to the lists | module: and `join' in Perl and many other languages. From happi@REDACTED Wed Jan 17 17:08:52 2001 From: happi@REDACTED (Erik Johansson) Date: Wed, 17 Jan 2001 17:08:52 +0100 Subject: Wishes: hex-output References: Message-ID: <00a101c0809f$c900c480$c90b0a0a@student.uu.se> ----- Original Message ----- From: > > If it's going to be late Christmas season, and one could make some > wishes, what about hex-output for io:format > Yes. I have always needed this. I use ~h and ~H. With the patch below you can do: > io:format("~h 0x~H 16#~h\n", [51966, 51966, 51966]). cafe 0xCAFE 16#cafe > /Erik Index: lib/stdlib/src/io_lib_format.erl =================================================================== RCS file: /home/harpo/csd/happi/hipe/repository/ngorongoro/osh2/lib/stdlib/src/io_lib_ format.erl,v retrieving revision 1.1.1.1 diff -r1.1.1.1 io_lib_format.erl 108a109,110 > collect_cc([$h|Fmt], [A|Args]) -> {$h,[A],Fmt,Args}; > collect_cc([$H|Fmt], [A|Args]) -> {$H,[A],Fmt,Args}; 170a173,176 > control($h, [A], F, Adj, P, Pad, I) when integer(A) -> > string(int_to_hex(A), F, Adj, P, Pad); > control($H, [A], F, Adj, P, Pad, I) when integer(A) -> > string(int_to_Hex(A), F, Adj, P, Pad); 174a181 > 390a398,412 > > %% Int_to_hex(Integer) > %% Convert an integer to a hexadecimal string... > > int_to_hex(N) when N < 10 -> [N+$0]; > int_to_hex(N) when N < 16 -> [N-10+$a]; > int_to_hex(N) -> > int_to_hex(N div 16) ++ > int_to_hex(N - (N div 16)*16). > > int_to_Hex(N) when N < 10 -> [N+$0]; > int_to_Hex(N) when N < 16 -> [N-10+$A]; > int_to_Hex(N) -> > int_to_Hex(N div 16) ++ > int_to_Hex(N - (N div 16)*16). From luke@REDACTED Wed Jan 17 17:12:18 2001 From: luke@REDACTED (Luke Gorrie) Date: 17 Jan 2001 17:12:18 +0100 Subject: lists:partition/2 In-Reply-To: Samuel Tardieu's message of "Wed, 17 Jan 2001 16:02:31 +0100" References: <3A6590B8.2022B0AF@erix.ericsson.se> <2001-01-17-16-02-32+trackit+sam@inf.enst.fr> Message-ID: Samuel Tardieu writes: > On 17/01, Daniel Neri wrote: > | Luke Gorrie writes: > | > | > %% separate(X, L): > | > %% Separate the elements of the list L by placing X between them. > | > | This one is called `intersperse' in the Haskell library, which could > | maybe also serve as inspiration for other additions to the lists > | module: > > and `join' in Perl and many other languages. There is something fun about different people deciding on the names "separate" and "join" for the same function. :-) Cheers, Luke From harald@REDACTED Thu Jan 18 01:45:36 2001 From: harald@REDACTED (Harald Sondergaard) Date: Thu, 18 Jan 2001 11:45:36 +1100 Subject: PPDP 2001: Call for Papers (second call) Message-ID: <200101180045.LAA21256@mundook.cs.mu.OZ.AU> (Apologies if you receive multiple copies of this announcement.) Third International Conference on PRINCIPLES AND PRACTICE OF DECLARATIVE PROGRAMMING Firenze, Italy, 5-7 September 2001 CALL FOR PAPERS PPDP 2001 aims to stimulate research on the use of declarative methods in programming and on the design, implementation and application of programming languages that support such methods. Topics of interest include any aspect related to understanding, integrating and extending programming paradigms such as those for functional, logic, constraint and object-oriented programming; concurrent extensions and mobile computing; type theory; support for modularity; use of logical methods in the design of program development tools; program analysis and verification; abstract interpretation; development of implementation methods; application of the relevant paradigms and associated methods in industry and education. This list is not exhaustive: submissions describing new and interesting ideas relating broadly to declarative programming are encouraged. The technical program of the conference will combine presentations of the accepted papers with invited talks and advanced tutorials. PPDP 2001 is part of a federation of colloquia known as Principles, Logics and Implementations of high-level programming languages (PLI 2001) which includes the ACM SIGPLAN International Conference on Functional Programming (ICFP 2001) and a large number of workshops devoted to aspects of programming languages. The colloquia will run from 2 to 8 September, 2001. The venue for the conference is Firenze (Florence), one of Europe's most attractive cities, famous for its churches, galleries and museums. More details can be found on the conference web site. Web Sites and Email Contact: PPDP 2001: http://music.dsi.unifi.it/pli01/ppdp PLI 2001: http://music.dsi.unifi.it/pli01 mailto:ppdp01@REDACTED Important Dates: Submission 15 March 2001 Notification 7 May 2001 Final Version 11 June 2001 Conference Chair: Rocco De Nicola, Universita di Firenze http://www.dsi.unifi.it/~denicola/ mailto:denicola@REDACTED Program Chair: Harald Sondergaard, The University of Melbourne http://www.cs.mu.oz.au/~harald/ mailto:harald@REDACTED Program Committee: Maria Alpuente, Univ. Politecnica de Valencia, ES Yves Caseau, Bouygues, FR Michael Codish, Ben-Gurion Univ. of the Negev, IL Saumya Debray, Univ. of Arizona, US Conal Elliott, Microsoft Research, US Sandro Etalle, Univ. Maastricht, NL Roberto Giacobazzi, Univ. di Verona, IT Michael Leuschel, Univ. of Southampton, GB John Lloyd, Australian National Univ., AU Torben Mogensen, Kobenhavns Univ., DK Alan Mycroft, Cambridge Univ., GB Gopalan Nadathur, Univ. of Minnesota, US Martin Odersky, Ecole Polyt. Fed. Lausanne, CH Catuscia Palamidessi, Penn State Univ., US Andreas Podelski, Max-Planck-Inst. Informatik, DE Kostis Sagonas, Uppsala Univ., SE Christian Schulte, Univ. des Saarlandes, DE Michael Schwartzbach, Aarhus Univ., DK Harald Sondergaard, Univ. of Melbourne, AU Peter J. Stuckey, Univ. of Melbourne, AU From rv@REDACTED Thu Jan 18 10:57:25 2001 From: rv@REDACTED (Robert Virding) Date: Thu, 18 Jan 2001 10:57:25 +0100 Subject: lists:partition/2 In-Reply-To: Your message of "17 Jan 2001 14:53:13 +0100." Message-ID: <200101180957.KAA03929@trana.bluetail.com> Luke Gorrie writes: >And here are a few other functions I've written lots of times: > > %% For 'lists' > %% separate(X, L): > %% Separate the elements of the list L by placing X between them. > %% e.g.: lists:flatten(separate(", ", ["foo", "bar", "baz"])) > %% => "foo, bar, baz" > separate(X, []) -> []; > separate(X, [H]) -> [H]; > separate(X, [H|T]) -> [H,X|separate(X, T)]. > > %% For 'lists' > %% first(Pred, List) > %% Find the first element of List satisfying Pred. > %% Returns: {value, Item} | false > first(Pred, []) -> > false; > first(Pred, [H|T]) -> > case Pred(H) of > true -> > {value, H}; > false -> > first(Pred, T) > end. The name is not 'first' is not very good to use for such a function. There is a function pair hd/tl (head/tail) which return the first element of a list and the other elements. There is also a function 'last' which returns the last element of a list. To have some form of name symmetry the function which returns all the elemnts except for the last should be called 'first'. There has been some wimpish grumbling that a name like 'first' is not very obvious for a function like that. The has been suggestions like 'but_last'. Can't understand the problem myself. :-) Anyway many other functional libraries have 'first'. Robert From rv@REDACTED Thu Jan 18 11:05:27 2001 From: rv@REDACTED (Robert Virding) Date: Thu, 18 Jan 2001 11:05:27 +0100 Subject: lists:partition/2 In-Reply-To: Your message of "Wed, 17 Jan 2001 13:31:52 +0100." <3A6590B8.2022B0AF@erix.ericsson.se> Message-ID: <200101181005.LAA03995@trana.bluetail.com> Raimo Niskanen writes: >Hello, > >I am missing function in the module lists, one that using a predicate >partitions a list into two; one with all elements for which the >predicate was true, and one for the rest, while preserving the ordering >of the elements. > >It could be defined as follows: >... >This could be accomplished with lists:foldr/3 like this: >... > >The latter one is unfortunately not tail recursive, and it is less >efficient because it assembles / disassembles a tuple in each loop >recursion. A function like partition would be useful. The latter may not be tail recursive (because foldr is not) but it may not be so much more inefficient as you save doing to reverses. In terms of memory they are almost equal. Robert From rv@REDACTED Thu Jan 18 11:14:22 2001 From: rv@REDACTED (Robert Virding) Date: Thu, 18 Jan 2001 11:14:22 +0100 Subject: Wishes: hex-output In-Reply-To: Your message of "Wed, 17 Jan 2001 17:08:52 +0100." <00a101c0809f$c900c480$c90b0a0a@student.uu.se> Message-ID: <200101181014.LAA04041@trana.bluetail.com> "Erik Johansson" writes: > >----- Original Message ----- >From: >> >> If it's going to be late Christmas season, and one could make some >> wishes, what about hex-output for io:format >> > >Yes. I have always needed this. I use ~h and ~H. With the patch below you >can do: >> io:format("~h 0x~H 16#~h\n", [51966, 51966, 51966]). >cafe 0xCAFE 16#cafe >> Seems reasonable. I'll add it. My only small qualm is that the coupling ~h/~H does not mean the same thing as ~w/~W and ~p/~P, but I suppose there is not real problem here. There should be probably be a matching hex-input flag for io:fread. I suppose I had better do that one as well. Robert From mickael.remond@REDACTED Mon Jan 22 16:48:10 2001 From: mickael.remond@REDACTED (Mickael Remond) Date: 22 Jan 2001 16:48:10 +0100 Subject: Embedding Erlang Message-ID: <87zogjegg5.fsf@western.ird.idealx.com> Hello Erlangers, I was thinking of embedding Erlang in devices with limited amount of RAM (16 Meg)and very limited disk storage space. Do you have any tips on how to do that ? Do you have any hint on: What are the minimum requirement for an Erlang system ? Do you know what are the required elements ? Should I use SAE (Stand Alone Erlang) as a way to run Erlang programs on the embedded device ? Thank you in advance for your help. -- Micka?l R?mond From cahill@REDACTED Mon Jan 22 17:52:09 2001 From: cahill@REDACTED (cahill) Date: Mon, 22 Jan 2001 16:52:09 +0000 Subject: SNMP + Mib problem : discarded for reason: snmpInBadVersions Message-ID: <3A6C6539.7461BF6A@ocean.ucc.ie> hi, I have configured the snmp agent on my local machine, started erlang with the with the configure parameter ( -configure ./sys.config ) and followed the example as supplied in the online Documentation. But everytime i try to send an snmp request ,( either get or set ) i get the following response: ** SNMP NET-IF LOG: packet from {{127,0,0,1},5000}, discarded for reason: snmpInBadVersions I have the snmp configured for snmp V3 . Has anyone encountered a problem like this b4?? tai Adrian From eis@REDACTED Wed Jan 24 13:09:21 2001 From: eis@REDACTED (Peter Eis) Date: Wed, 24 Jan 2001 13:09:21 +0100 Subject: Erlang limits Message-ID: <3A6EC5F1.3040101@hagen-partner.de> Hello, I've read that it should be possible to increase the maximum number of nodes in an Erlang network. We have found some source files where the limit of 256 nodes is defined and tried to compile the sources but it didn't work. As we are planning to create an application where it it most likely that we will have more than 256 nodes connected to each other this is a serious problem for us. I'd very much appreciate if someone could give me a hint how to solve this problem. Thanks, Peter From etxuwig@REDACTED Wed Jan 24 13:43:11 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 24 Jan 2001 13:43:11 +0100 (MET) Subject: Erlang limits In-Reply-To: <3A6EC5F1.3040101@hagen-partner.de> Message-ID: On Wed, 24 Jan 2001, Peter Eis wrote: >Hello, > >I've read that it should be possible to increase the maximum number >of nodes in an Erlang network. We have found some source files where >the limit of 256 nodes is defined and tried to compile the sources >but it didn't work. I have not studied the intricacies of this problem, but I can imagine that you'd have to look at how pids are represented (a one-byte number represents the node identity), and look at the source for epmd as well. I'm sure someone else will give you better advice. >As we are planning to create an application where it it most likely >that we will have more than 256 nodes connected to each other this >is a serious problem for us. It may not be an unsurmountable problem if your application is not such that all nodes must talk to each other, or one or more nodes must be in contact with all other nodes. If you start the erlang nodes with the flag -connect_all false, then erlang will not make sure that all nodes connect to all other nodes. Nodes will still connect automatically as soon as a process on one node tries to send a message to a process on another node, but this is something that you can control in your application. Running your network with connect_all=false means that each node will only know about a subset of the other nodes -- as long as this subset is < 256, you won't have a problem with the limit. You might want to consider using a sort of proxy nodes. It is not too hard to write a proxy process that allows you to send messages to any given node in the network, but where the message may have to pass through another node on the way. If you'd want to use mnesia on all nodes, you have a bit of a problem, since you can't tell mnesia to use your proxy to communicate. In this case, you may need to hack the proxy functionality into the net_kernel. This is fairly advanced Erlang hacking, but help sometimes comes from unexpected places... Note that you can't use globally registered names if you turn off connect_all. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From eis@REDACTED Wed Jan 24 15:34:54 2001 From: eis@REDACTED (Peter Eis) Date: Wed, 24 Jan 2001 15:34:54 +0100 Subject: Erlang limits References: Message-ID: <3A6EE80E.7040201@hagen-partner.de> Ulf Wiger wrote: >> As we are planning to create an application where it it most likely >> that we will have more than 256 nodes connected to each other this >> is a serious problem for us. > > > It may not be an unsurmountable problem if your application is not > such that all nodes must talk to each other, or one or more nodes must > be in contact with all other nodes. > > If you start the erlang nodes with the flag -connect_all false, > then erlang will not make sure that all nodes connect to all other > nodes. Nodes will still connect automatically as soon as a process on > one node tries to send a message to a process on another node, but > this is something that you can control in your application. That really might save us from further troubles. Indeed only some nodes have to be fully connected while the clients don't have to know each other. > > > Running your network with connect_all=false means that each node will > only know about a subset of the other nodes -- as long as this subset > is < 256, you won't have a problem with the limit. > > You might want to consider using a sort of proxy nodes. It is not too > hard to write a proxy process that allows you to send messages to any > given node in the network, but where the message may have to pass > through another node on the way. We discussed that possibility too. In combination with connect_all=false I think it's the way we'll go as now we just have to set up some nodes to communicate with the clients. The only disadvantage is that the messages will have to pass one more node. But as passing messages is pretty fast that won't be a problem. Thank you very much for the quick response. Regard, Peter From rv@REDACTED Wed Jan 24 15:39:39 2001 From: rv@REDACTED (Robert Virding) Date: Wed, 24 Jan 2001 15:39:39 +0100 Subject: Beam files, module beam_lib and source code Message-ID: <200101241439.PAA26146@trana.bluetail.com> Try: > {ok, {_,[{_,{_,Forms}}]}} = beam_lib:chunks(YourBeamFile,[abstract_code]). ... > lists:foreach(fun(F) -> io:put_chars(user,[erl_pp:form(F),"\n"]) end, Forms). To help the debugger the source code in abstract form can be included in the beam file. Unfortunately the default is to include it. Giving the option 'no_debug_info' causes the compiler to not include the code. While it is very nice to have a debugger I don't think source should be included as default. Here is a little patch to compile.erl which inverts this behaviour, the default is to NOT include the source and you must give the option 'debug_info' to include source. *** compile.erl~ Wed Jan 24 14:40:36 2001 --- compile.erl Wed Jan 24 15:05:16 2001 *************** *** 335,341 **** {iff,dexp,{listing,"expand"}}, {iff,'E',{src_listing,"E"}}, {iff,'abstr',{listing,"abstr"}}, ! {unless,no_debug_info,?pass(save_abstract_code)}, %% Core Erlang passes. {pass,v3_core}, --- 335,341 ---- {iff,dexp,{listing,"expand"}}, {iff,'E',{src_listing,"E"}}, {iff,'abstr',{listing,"abstr"}}, ! {iff,debug_info,?pass(save_abstract_code)}, %% Core Erlang passes. {pass,v3_core}, Apply the patch to lib/compiler/src/compile.erl and remake. Robert From vances@REDACTED Wed Jan 24 19:44:10 2001 From: vances@REDACTED (Vance Shipley) Date: Wed, 24 Jan 2001 13:44:10 -0500 Subject: Beam files, module beam_lib and source code In-Reply-To: <200101241439.PAA26146@trana.bluetail.com> Message-ID: Robert Virding writes: } } While it is very nice to have a debugger I don't think source should be } included as default. This is very suprising behaviour indeed. As someone who bases commercial products on Erlang/OTP I obviously immediately reversed this behaviour in our build environment. -Vance From spearce@REDACTED Fri Jan 26 03:19:17 2001 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 25 Jan 2001 21:19:17 -0500 Subject: OtpErlangTuple fails on 0 arity tuples Message-ID: <20010125211917.U6819@spearce.org> I have an Erlang node which just sent an empty tuple ({}) to a Java node. When I asked for the arity of that tuple, I expected to get 0. Instead I got a NullPointerException in the arity() method of OtpErlangJava. Apparently, when the tuple is read in from the network its arity is 0 so the elems array inside of the OtpErlangJava was never initialized. This caused the Java expression 'elems.length' to fail. This error shows up in R7B-0. I've included a patch below which definately fixes the problem. If 0 arity tuples were not meant to be supported in Erlang, perhaps the compiler should be fixed to prevent making 0 arity tuples. :-) -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' *** OtpErlangTuple.java.orig Thu Jan 25 21:11:39 2001 --- OtpErlangTuple.java Thu Jan 25 21:13:58 2001 *************** *** 105,113 **** this.elems = new OtpErlangObject[arity]; for (int i=0; i In R7B-0, the JInterface (Java side) objects are missing overriding methods for the hashCode() method. This makes them impossible to ues in a java.util.Hashtable, as two different instances of an OtpErlangAtom (even if they have the same name) do not hash to the same location in the Hashtable, and therefore cannot ever be considered equal. Now it wouldn't be so bad if I made the objects by hand, but in this case the OtpErlangAtoms are being sent over from an existing ERTS based node and are coming out with different hashCodes. Attached below is a set of patches which add the missing hashCode methods (sorry, no Javadoc added). It also includes the acceptor.start() bug fix that was already noted for R7B-0, as well as the patch from my previous email to support 0 arity tuples. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java Tue Aug 22 08:01:26 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java Thu Jan 25 23:49:58 2001 *************** *** 135,140 **** --- 135,149 ---- } /** + * Get the hashcode of the atom value. + * + * @return hashCode of atomValue(). + **/ + public int hashCode() { + return this.atom.hashCode(); + } + + /** * Convert this atom to the equivalent Erlang external representation. * * @param buf an output stream to which the encoded atom should be diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java Tue Aug 22 08:01:29 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java Thu Jan 25 23:58:42 2001 *************** *** 180,186 **** return true; } ! public Object clone() { OtpErlangBinary newBin = (OtpErlangBinary)(super.clone()); newBin.bin = (byte[])bin.clone(); --- 180,196 ---- return true; } ! ! public int hashCode() { ! int hc = 0; ! ! int size = this.size(); ! for(int x = 0; x < size; x++) { ! hc += this.bin[x]; ! } ! return hc; ! } ! public Object clone() { OtpErlangBinary newBin = (OtpErlangBinary)(super.clone()); newBin.bin = (byte[])bin.clone(); diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java Tue Aug 22 08:01:40 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java Thu Jan 25 23:53:20 2001 *************** *** 113,116 **** --- 113,121 ---- OtpErlangDouble d = (OtpErlangDouble)o; return this.d == d.d; } + + public int hashCode() { + return (int)(d * 100); + } + } diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java Tue Aug 22 08:01:50 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java Thu Jan 25 23:54:26 2001 *************** *** 230,235 **** --- 230,244 ---- return true; } + public int hashCode() { + int a = this.arity(); + int hc = 0; + for (int i = 0; i < a; i++) { + hc += this.elems[i].hashCode(); + } + return hc; + } + public Object clone() { OtpErlangList newList = (OtpErlangList)(super.clone()); newList.elems = (OtpErlangObject[])elems.clone(); diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java Tue Aug 22 08:01:52 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java Thu Jan 25 23:54:44 2001 *************** *** 222,225 **** --- 222,229 ---- OtpErlangLong l = (OtpErlangLong)o; return this.val == l.val; } + + public int hashCode() { + return (int)this.val; + } } diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java Tue Aug 22 08:02:14 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java Thu Jan 25 21:13:58 2001 *************** *** 105,113 **** this.elems = new OtpErlangObject[arity]; for (int i=0; i My last patch missed OtpErlangTuple's hashCode() method. This patch replaces the last one, as it includes the new method, plus everthing else. -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java Tue Aug 22 08:01:26 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java Thu Jan 25 23:49:58 2001 *************** *** 135,140 **** --- 135,149 ---- } /** + * Get the hashcode of the atom value. + * + * @return hashCode of atomValue(). + **/ + public int hashCode() { + return this.atom.hashCode(); + } + + /** * Convert this atom to the equivalent Erlang external representation. * * @param buf an output stream to which the encoded atom should be diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java Tue Aug 22 08:01:29 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangBinary.java Thu Jan 25 23:58:42 2001 *************** *** 180,186 **** return true; } ! public Object clone() { OtpErlangBinary newBin = (OtpErlangBinary)(super.clone()); newBin.bin = (byte[])bin.clone(); --- 180,196 ---- return true; } ! ! public int hashCode() { ! int hc = 0; ! ! int size = this.size(); ! for(int x = 0; x < size; x++) { ! hc += this.bin[x]; ! } ! return hc; ! } ! public Object clone() { OtpErlangBinary newBin = (OtpErlangBinary)(super.clone()); newBin.bin = (byte[])bin.clone(); diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java Tue Aug 22 08:01:40 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangDouble.java Thu Jan 25 23:53:20 2001 *************** *** 113,116 **** --- 113,121 ---- OtpErlangDouble d = (OtpErlangDouble)o; return this.d == d.d; } + + public int hashCode() { + return (int)(d * 100); + } + } diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java Tue Aug 22 08:01:50 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java Thu Jan 25 23:54:26 2001 *************** *** 230,235 **** --- 230,244 ---- return true; } + public int hashCode() { + int a = this.arity(); + int hc = 0; + for (int i = 0; i < a; i++) { + hc += this.elems[i].hashCode(); + } + return hc; + } + public Object clone() { OtpErlangList newList = (OtpErlangList)(super.clone()); newList.elems = (OtpErlangObject[])elems.clone(); diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java Tue Aug 22 08:01:52 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangLong.java Thu Jan 25 23:54:44 2001 *************** *** 222,225 **** --- 222,229 ---- OtpErlangLong l = (OtpErlangLong)o; return this.val == l.val; } + + public int hashCode() { + return (int)this.val; + } } diff -r -c otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java *** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java Tue Aug 22 08:02:14 2000 --- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangTuple.java Fri Jan 26 00:59:31 2001 *************** *** 105,113 **** this.elems = new OtpErlangObject[arity]; for (int i=0; i Message-ID: On Thu, 25 Jan 2001, Shawn Pearce wrote: >If 0 arity tuples were not meant to be supported in Erlang, perhaps >the compiler should be fixed to prevent making 0 arity tuples. :-) 0 arity tuples are definitely supported in Erlang. Sometimes, they're even useful. ;) /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From spearce@REDACTED Fri Jan 26 14:59:26 2001 From: spearce@REDACTED (Shawn Pearce) Date: Fri, 26 Jan 2001 08:59:26 -0500 Subject: OtpErlangTuple fails on 0 arity tuples In-Reply-To: ; from etxuwig@etxb.ericsson.se on Fri, Jan 26, 2001 at 09:24:58AM +0100 References: <20010125211917.U6819@spearce.org> Message-ID: <20010126085925.X6819@spearce.org> Hence why I was sending them from an Erlang node to a Java node? :) My Java node expected a tuple there, and a 0 arity tuple meant something special. Buuuuut, code broke. :-) Ulf Wiger scrawled: > On Thu, 25 Jan 2001, Shawn Pearce wrote: > > >If 0 arity tuples were not meant to be supported in Erlang, perhaps > >the compiler should be fixed to prevent making 0 arity tuples. :-) > > 0 arity tuples are definitely supported in Erlang. > > Sometimes, they're even useful. ;) > > /Uffe > -- > Ulf Wiger tfn: +46 8 719 81 95 > Senior System Architect mob: +46 70 519 81 95 > Strategic Product & System Management ATM Multiservice Networks > Data Backbone & Optical Services Division Ericsson Telecom AB -- Shawn. ``If this had been a real life, you would have received instructions on where to go and what to do.'' From aas23@REDACTED Fri Jan 26 17:01:55 2001 From: aas23@REDACTED (A.A. Serjantov) Date: Fri, 26 Jan 2001 16:01:55 +0000 (GMT) Subject: Hot-swapping code Message-ID: Hi, I am interested in the semantics of hot-swapping code in Erlang, and so far I've only been able to find a tiny example in the (free part of the) "Erlang Book" and a few references on this mailing list. Could anyone send me a pointer to papers, language definition or some other documentation on the subject? Thanks in advance, Andrei ------------------ Andrei Serjantov Queens' College Cambridge CB3 9ET http://www.cl.cam.ac.uk/~aas23/ From etxhste@REDACTED Fri Jan 26 20:20:50 2001 From: etxhste@REDACTED (Hakan Stenholm) Date: Fri, 26 Jan 2001 20:20:50 +0100 Subject: Porting erlang to MacOS X ? Message-ID: <3A71CE11.B0CAE7DF@etxb.ericsson.se> I'm quite interested if anyone knows anything about this, I can't realy see any seriouse problems that could make this imposible. * Erlang works fine when compiled in PPC linux versions (LinuxPPC and SuSE) on both G3 and G4 macs so hardwarevise this should be ok. * MacOS X (~ BSD with MacOS GUI) seams to include all the unix stuff erlang needs (like PERL 5, Java 1.2, gcc ...) Not quite unexpectedly the regular compile procedure didn't work, as I have to admit that I am sorely lacking in shell script expirence I can't realy figure out what the make files do. I'm currently interested to know if anyone has a clue as to how much work would be needed to get it working (at least VM and basic modules like lists, ets ...), sadly I'm not sure if I have the expirience or the time (I'm allready hacking on a strategy game in erlang using linux as dev. platform) to actualy do this. Expirience from the FreeBSD port might be usefull. ps: the guy (preilly@REDACTED) who was noted as working on a MacOS version on the erlang.org site, who I mailed to a year ago asking about progress and MacOS version of the port, hasn't answeard the mail I sent a couple of days ago. When I inquired (to kent@REDACTED : "For comments or questions about this site") about his mail adress a couple of months ago I got the respons that they hadn't heard anything about the port progress either - so I have no high hopes that any port is going to appear in the forseable future. From dne@REDACTED Fri Jan 26 20:52:16 2001 From: dne@REDACTED (Daniel Neri) Date: 26 Jan 2001 20:52:16 +0100 Subject: Porting erlang to MacOS X ? In-Reply-To: Hakan Stenholm's message of "Fri, 26 Jan 2001 20:20:50 +0100" References: <3A71CE11.B0CAE7DF@etxb.ericsson.se> Message-ID: <87u26mf5vz.fsf@nowhere.mayonnaise.net> Hakan Stenholm writes: > Not quite unexpectedly the regular compile procedure didn't work, as > I have to admit that I am sorely lacking in shell script expirence > I can't realy figure out what the make files do. If you show us the error messages and maybe the config.log file, I'm sure someone could help you out. (You're using GNU make, right?) > Expirience from the FreeBSD port might be usefull. Actually, R7B-1 should compile out-of-the-box on FreeBSD (I know first-hand that it does on OpenBSD and NetBSD). It could well be that teaching erts/autoconf/config.{guess,sub} about MacOS X/Darwin is enough to make things work. Try replacing them with something a bit more recent: http://subversions.gnu.org/cgi-bin/cvsweb/config/ Best wishes, --Daniel -- Daniel Neri dne@REDACTED From taavi@REDACTED Fri Jan 26 20:57:46 2001 From: taavi@REDACTED (Taavi Talvik) Date: Fri, 26 Jan 2001 21:57:46 +0200 (EET) Subject: Porting erlang to MacOS X ? In-Reply-To: <87u26mf5vz.fsf@nowhere.mayonnaise.net> Message-ID: On 26 Jan 2001, Daniel Neri wrote: > Hakan Stenholm writes: > > > Not quite unexpectedly the regular compile procedure didn't work, as > > I have to admit that I am sorely lacking in shell script expirence > > I can't realy figure out what the make files do. > > If you show us the error messages and maybe the config.log file, I'm > sure someone could help you out. (You're using GNU make, right?) > > > Expirience from the FreeBSD port might be usefull. > > Actually, R7B-1 should compile out-of-the-box on FreeBSD (I know > first-hand that it does on OpenBSD and NetBSD). Yes, R7B-1 compiles out-of-the-box on FreeBSD. Only issue is, that you sould have jdk-1.2 installed and default java environment. At first install /usr/ports/devel/gmake /usr/ports/java/linux-jdk best regards, taavi From alexis@REDACTED Sat Jan 27 02:35:27 2001 From: alexis@REDACTED (Alexis Le-Quoc) Date: Fri, 26 Jan 2001 20:35:27 -0500 (EST) Subject: Makefile and Erlang Message-ID: Hello, First of all, let me state the obvious, the more I use Erlang, the more impressed I am! I've been fiddling with the release tools and I find them absolutely useful. I'm stumbling on two problems: 1) I wrote a Makefile (for GNU make) which is about 3 lines long: all: erl -noinput -make echo "systools:make_tar(app1)." | erl -noshell The third line obviously never returns but produces the expected .tar.gz. It looks like: lib/app-1/... lib/kernel-.../... lib/sasl-.../... lib/stdlib-.../... releases/1/start.boot 2) Once I have that tarball, I un-tar it to my_directory and do a cd my_directory. Then I try erl -boot releases/1/start but it crashes since I suspect it does not find the appropriate *.beam files. I'm missing something here. Is is the {path, Path} trick in the .rel file? Thank you, -- Alexis From vances@REDACTED Sat Jan 27 03:05:27 2001 From: vances@REDACTED (Vance Shipley) Date: Fri, 26 Jan 2001 21:05:27 -0500 Subject: Makefile and Erlang In-Reply-To: Message-ID: Alexis Le-Quoc writes: > > 1) I wrote a Makefile (for GNU make) which is about 3 lines long: > all: > erl -noinput -make > echo "systools:make_tar(app1)." | erl -noshell > > The third line obviously never returns but produces the expected .tar.gz. Alexis, This is what I use in our Makefile (abreviated version attached): %.tar.gz: all %.boot erl -noshell -s systools make_script $* -s erlang halt erl -noshell -s systools make_tar $* -s erlang halt > 2) Once I have that tarball, I un-tar it to my_directory and do a cd > my_directory. Then I try erl -boot releases/1/start but it crashes since I > suspect it does not find the appropriate *.beam files. I'm missing > something here. Is is the {path, Path} trick in the .rel file? > > Thank you, > > -- Alexis I'm not sure but I know that it isn't working for me because I'm not getting all my applications files into the tarball. It puts all the *.beam files in but not the priv/bin & priv/data files. I haven't gotten around to figuring out how to do that yet. -Vance -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: application/octet-stream Size: 1267 bytes Desc: not available URL: From vances@REDACTED Sat Jan 27 03:19:20 2001 From: vances@REDACTED (Vance Shipley) Date: Fri, 26 Jan 2001 21:19:20 -0500 Subject: Makefile and Erlang In-Reply-To: Message-ID: I wrote: > This is what I use in our Makefile (abreviated version attached): > > %.tar.gz: all %.boot > erl -noshell -s systools make_script $* -s erlang halt > erl -noshell -s systools make_tar $* -s erlang halt I should have said that I use it as: $ make January2001.tar.gz where I have a release file named January2001.rel -Vance From zenem@REDACTED Sun Jan 28 03:31:00 2001 From: zenem@REDACTED (Zeno) Date: Sat, 27 Jan 2001 18:31:00 -0800 Subject: How limited is the support for Windows 98? Message-ID: As I read about various libraries of Erlang OTP, methods are described for Unix, Solaris, and NT. How many of the libraries will not work on Win98? Which ones? Is this documented anywhere? Thank you, - Zeno From jakob@REDACTED Mon Jan 29 10:07:37 2001 From: jakob@REDACTED (Jakob Cederlund =?iso-8859-1?Q?p=E5?= UAB) Date: Mon, 29 Jan 2001 10:07:37 +0100 Subject: Porting erlang to MacOS X ? In-Reply-To: References: <87u26mf5vz.fsf@nowhere.mayonnaise.net> Message-ID: <5.0.2.1.0.20010129095856.00b46720@mail> Hello fellow erlangers! I have ported Erlang to MacOSX, quite easily, just hacking a bit in the configure scripts. I have no numbers on performance yet, but it seems reasonably fast. (My 266MHz G3 being on par with a 500MHz Pentium II windows machine.) I am also experimenting with the graphical interface. As you know, MacOSX doesn't use X-windows, instead it has a interface called Aqua, which is a newer version of NextStep. I have two ways to use GUI on MacOSX: a erl_interface-based module which can be used with the Interface Builder to create a Mac GUI to an Erlang program; and an attempt to port gs, that still has lots of work to be usable (i.e. good enough to run the debugger). Please let me know if anyone's interested, or willing to help. I'm planning to make an open source-release of OTP on MacOSX, after I've tested it with the released MacOSX. /Jakob From Siri.Hansen@REDACTED Mon Jan 29 10:39:00 2001 From: Siri.Hansen@REDACTED (Siri Hansen) Date: Mon, 29 Jan 2001 09:39:00 +0000 Subject: Hot-swapping code References: Message-ID: <3A753A34.6FFEFD88@eei.ericsson.se> Hi Andrei! The SASL User Guide and Reference Manual is what you need: http://www.erlang.org/doc/current/lib/sasl-1.9/doc/index.html Regards /siri "A.A. Serjantov" wrote: > > Hi, > > I am interested in the semantics of hot-swapping code in Erlang, and so > far I've only been able to find a tiny example in the (free part of > the) "Erlang Book" and a few references on this mailing list. > > Could anyone send me a pointer to papers, language definition > or some other documentation on the subject? > > Thanks in advance, > > Andrei > > ------------------ > Andrei Serjantov > Queens' College > Cambridge CB3 9ET > http://www.cl.cam.ac.uk/~aas23/ From Sean.Hinde@REDACTED Mon Jan 29 11:52:42 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 29 Jan 2001 10:52:42 -0000 Subject: Makefile and Erlang Message-ID: <402DD461F109D411977E0008C791C312039F5CF0@imp02mbx.one2one.co.uk> Alexis, A few things which might be of use.. After untarring you need to also move some files around and set up some paths in other files. The Install shell script embedded in the depths of the open source distribution (erts/etc/unix) can be used for this (it does all sorts of stuff including building start.boot files etc). I also attach my version which is somewhat cut down from the full one but deals with a few other things like setting up the IP address in my SNMP config files etc. It also uses start.src from this directory which you can edit beforehand to add any other fixed options you want such as -embedded etc Usage is ./Install erl-root-dir release-vsn rel-file node-name So for your case I guess it would be something like ./Install /home/otpuser../ 1 app1 nodename If it doesn't run straight away in your environment it should give you some idea of the sorts of things you need to do Good luck, Sean > -----Original Message----- > From: Alexis Le-Quoc [mailto:alexis@REDACTED] > Sent: 27 January 2001 01:35 > To: erlang-questions@REDACTED > Subject: Makefile and Erlang > > > Hello, > > First of all, let me state the obvious, the more I use > Erlang, the more > impressed I am! I've been fiddling with the release tools and > I find them > absolutely useful. > > I'm stumbling on two problems: > > 1) I wrote a Makefile (for GNU make) which is about 3 lines long: > all: > erl -noinput -make > echo "systools:make_tar(app1)." | erl -noshell > > The third line obviously never returns but produces the > expected .tar.gz. > > It looks like: > lib/app-1/... > lib/kernel-.../... > lib/sasl-.../... > lib/stdlib-.../... > releases/1/start.boot > > 2) Once I have that tarball, I un-tar it to my_directory and do a cd > my_directory. Then I try erl -boot releases/1/start but it > crashes since I > suspect it does not find the appropriate *.beam files. I'm missing > something here. Is is the {path, Path} trick in the .rel file? > > Thank you, > > -- Alexis > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. -------------- next part -------------- A non-text attachment was scrubbed... Name: Install Type: application/octet-stream Size: 3448 bytes Desc: not available URL: From etxuwig@REDACTED Mon Jan 29 12:07:22 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 29 Jan 2001 12:07:22 +0100 (MET) Subject: Porting erlang to MacOS X ? In-Reply-To: <5.0.2.1.0.20010129095856.00b46720@mail> Message-ID: On Mon, 29 Jan 2001, Jakob Cederlund p? UAB wrote: >Hello fellow erlangers! > >I have ported Erlang to MacOSX, quite easily, just hacking a bit in >the configure scripts. I have no numbers on performance yet, but it >seems reasonably fast. (My 266MHz G3 being on par with a 500MHz >Pentium II windows machine.) It's about time! Unfortunately, I don't have a Mac capable of running MacOSX (I have a dead PowerBook 140 and a working PowerBook Duo, believe it or not.) My Mac days are behind me (but who knows what the future might bring.), but I will brag a little about having run Erlang on the Mac back in 1992. It wasn't stable enough to be useable. Boy, if I had had a stable Erlang/OTP environment back then....... >I am also experimenting with the graphical interface. As you know, >MacOSX doesn't use X-windows, instead it has a interface called >Aqua, which is a newer version of NextStep. I have two ways to use >GUI on MacOSX: a erl_interface-based module which can be used with >the Interface Builder to create a Mac GUI to an Erlang program; and >an attempt to port gs, that still has lots of work to be usable >(i.e. good enough to run the debugger). It sounds to me like doing a nice, clean coupling to the Interface Builder is the way to go for new apps. >Please let me know if anyone's interested, or willing to help. I can give you an enthusiastic cheer once in a while. (: /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From thomas@REDACTED Mon Jan 29 13:15:46 2001 From: thomas@REDACTED (Thomas Arts) Date: Mon, 29 Jan 2001 13:15:46 +0100 Subject: Porting erlang to MacOS X ? References: <87u26mf5vz.fsf@nowhere.mayonnaise.net> <5.0.2.1.0.20010129095856.00b46720@mail> Message-ID: <3A755EF2.412C78AB@cslab.ericsson.se> You just gave me the final argument for buying that beautiful G4! /Thomas Jakob Cederlund p? UAB wrote: > > Hello fellow erlangers! > > I have ported Erlang to MacOSX, quite easily, just hacking a bit in the > configure scripts. I have no numbers on performance yet, but it seems > reasonably fast. (My 266MHz G3 being on par with a 500MHz Pentium II > windows machine.) > > I am also experimenting with the graphical interface. As you know, MacOSX > doesn't use X-windows, instead it has a interface called Aqua, which is a > newer version of NextStep. I have two ways to use GUI on MacOSX: a > erl_interface-based module which can be used with the Interface Builder to > create a Mac GUI to an Erlang program; and an attempt to port gs, that > still has lots of work to be usable (i.e. good enough to run the debugger). > > Please let me know if anyone's interested, or willing to help. > > I'm planning to make an open source-release of OTP on MacOSX, after I've > tested it with the released MacOSX. > > /Jakob From daniel.neri@REDACTED Mon Jan 29 19:15:04 2001 From: daniel.neri@REDACTED (Daniel Neri) Date: 29 Jan 2001 19:15:04 +0100 Subject: os:cmd/1 and binary output (PATCH) Message-ID: Hi, I just happened to try using os:cmd/1 to collect the output of a program producing binary data. As the current implementation doesn't allow this, I propose a minor change (which actually simplifies things a wee bit): -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/x-diff Size: 1557 bytes Desc: os.erl patch URL: -------------- next part -------------- (The problem only affects Erlang running on Unix.) Best wishes, --Daniel -- Daniel Neri mailto:dn@REDACTED Sigicom AB, Sweden http://www.sigicom.com From alexis@REDACTED Tue Jan 30 03:27:46 2001 From: alexis@REDACTED (Alexis Le-Quoc) Date: Mon, 29 Jan 2001 21:27:46 -0500 (EST) Subject: Makefile and Erlang In-Reply-To: <402DD461F109D411977E0008C791C312039F5CF0@imp02mbx.one2one.co.uk> Message-ID: Thank you Sean and Vance for your most helpful answers. The erlang community is great! I've read and read and read again the documentation about make_script and make_tar. I've furthered my understanding a bit and I'd like to ask the experts if the following is possible. I've packaged my app in app1.tar.gz but a closer look at the start.script makes me think that all paths are defined relative to $ROOT. I infer that $ROOT is set by the 'erl' script and cannot be changed at run-time. I'd like to change that path to something I choose. The {variable, [{"TEST", "some_path"]} and {path, [...]} in systools:make_script/2 put a $TEST in the boot script. Then, I un-tarred the file to some place and ran: erl -boot_var TEST `pwd`/lib -boot `pwd`/releases/1/start but it crashes the VM, since it can't find the code. I set TEST to `pwd`/lib because the $TEST variable appears followed by myapp-vsn/ebin in the script. To no avail. I also tried to set TEST to the directory where I un-tarred the package; it did not work either. I took a look at the Install script that you sent and I'd like, for testing purposes, not to copy the erl/erlc to the new directory. This problem, overall, looks a bit like the classical java "CLASSPATH not set" problem. Maybe I should look into the code_server / loader documentation to clarify this issue. Alexis On Mon, 29 Jan 2001, Sean Hinde wrote: > Alexis, > > A few things which might be of use.. > > After untarring you need to also move some files around and set up some > paths in other files. > > The Install shell script embedded in the depths of the open source > distribution (erts/etc/unix) can be used for this (it does all sorts of > stuff including building start.boot files etc). I also attach my version > which is somewhat cut down from the full one but deals with a few other > things like setting up the IP address in my SNMP config files etc. > > It also uses start.src from this directory which you can edit beforehand to > add any other fixed options you want such as -embedded etc > > Usage is > > ./Install erl-root-dir release-vsn rel-file node-name > > So for your case I guess it would be something like > ./Install /home/otpuser../ 1 app1 nodename > > If it doesn't run straight away in your environment it should give you some > idea of the sorts of things you need to do > > Good luck, > > Sean > > > -----Original Message----- > > From: Alexis Le-Quoc [mailto:alexis@REDACTED] > > Sent: 27 January 2001 01:35 > > To: erlang-questions@REDACTED > > Subject: Makefile and Erlang > > > > > > Hello, > > > > First of all, let me state the obvious, the more I use > > Erlang, the more > > impressed I am! I've been fiddling with the release tools and > > I find them > > absolutely useful. > > > > I'm stumbling on two problems: > > > > 1) I wrote a Makefile (for GNU make) which is about 3 lines long: > > all: > > erl -noinput -make > > echo "systools:make_tar(app1)." | erl -noshell > > > > The third line obviously never returns but produces the > > expected .tar.gz. > > > > It looks like: > > lib/app-1/... > > lib/kernel-.../... > > lib/sasl-.../... > > lib/stdlib-.../... > > releases/1/start.boot > > > > 2) Once I have that tarball, I un-tar it to my_directory and do a cd > > my_directory. Then I try erl -boot releases/1/start but it > > crashes since I > > suspect it does not find the appropriate *.beam files. I'm missing > > something here. Is is the {path, Path} trick in the .rel file? > > > > Thank you, > > > > -- Alexis > > From gunilla@REDACTED Tue Jan 30 09:36:42 2001 From: gunilla@REDACTED (Gunilla Hugosson) Date: Tue, 30 Jan 2001 09:36:42 +0100 Subject: Makefile and Erlang References: Message-ID: <3A767D1A.454CFDB1@erix.ericsson.se> Alexis Le-Quoc wrote: [snip] > The {variable, [{"TEST", "some_path"]} and {path, [...]} in > systools:make_script/2 put a $TEST in the boot script. Then, I un-tarred > the file to some place and ran: > > erl -boot_var TEST `pwd`/lib -boot `pwd`/releases/1/start but it crashes > the VM, since it can't find the code. I set TEST to `pwd`/lib because the > $TEST variable appears followed by myapp-vsn/ebin in the script. To no > avail. I also tried to set TEST to the directory where I un-tarred > the package; it did not work either. Alexis, What you describe above (using a variable when generating the script using systools:make_script/2 and setting its value using -boot_var `pwd`/lib) is perfectly correct and should work. Are you sure the value of TEST="some directory" is correct? What happens when you try to start erl, what error messages do you get? Is the application sasl included in your .rel-file? If not, add it, as it will generate more printouts when starting Erlang that might be useful for debugging. Note also that systools:make_tar is primarily intended for building a tar file that is used to upgrade an already existing system. / Gunilla From Sean.Hinde@REDACTED Tue Jan 30 13:11:53 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Tue, 30 Jan 2001 12:11:53 -0000 Subject: Makefile and Erlang Message-ID: <402DD461F109D411977E0008C791C312039F5D01@imp02mbx.one2one.co.uk> > Note also that systools:make_tar is primarily intended for > building a tar file that is used to upgrade an already > existing system. It is, and that is a bit of a shame. It is not at all obvious from the docs that this is the case, and then not at all clear how to create an initial release which works. I struggled with this for quite some time before getting help under my commercial support agreement. Having said that, the tar file created with systools:make_tar("app1", [{erts, "/home/user/erl5.0.1"}]). has all the files required for a full installation and I use it all the time in combination with the Install script attached to my last post to build and install new installations. Ach, here goes: The complete procedure I use is to put all my own apps into a dedicated build directory like: Build--myapp-1.0/ebin | -myapp2-1.3/ebin In this dir I also put the sys.config I wish to use and the .rel file for all the applications including the standard ones I wish to include. "app1.rel" contains e.g: {release, {"app1 initial build","app1"}, {erts, "5.0.1"}, [{kernel,"2.6.1.6"}, {stdlib,"1.9.3"}, {sasl, "1.9.1"}, {runtime_tools, "1.1.2"}, {os_mon, "1.3.9"}, {snmp, "3.2.1"}, {mnesia, "3.9.3"}, {myapp, "1.0"}, {myapp2, "1.3"}]}. "sys.config" usefully can have at least this (as my Install creates this dir for sasl files): [{sasl, [{error_logger_mf_dir, "/../target_install_dir/sasl_logfiles/"}]. In here I also have a .erlang which looks like: Myroot = "/opt/erlang/Build/". code:add_pathz(Myroot++"myapp-1.0/ebin"). code:add_pathz(Myroot++"myapp2-1.3/ebin"). So, after making sure that my two own apps have correct .app files in their ebin dirs I just run up an erlang shell (the same one containing the desired versions of the standard apps) then: 1>systoools:make_script("app1"). ok 2> systools:make_tar("app1", [{erts, "/home/user/erl5.0.1"}]). ok If you copy the tar file to your host machine, untar it and run the Install script you should have something which starts the whole app using bin/start run directly from the untar directory. Then to attach to the shell for this node use: bin/to_erl You get some nice error info in the log directory if it fails to start up (i.e. if there is a problem with startup of any of the included apps it crashes) You can also use bin/erl which will use the start.boot in the bin dir (copied from the erts-5.0.1/bin dir by Install) This is about as simple as I have managed to make the process and it works every time for me in my environment (I've never tested it on open source Erlang - the initial whereabouts of start.src files etc is quite possibly a bit different). - Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxhste@REDACTED Tue Jan 30 17:47:50 2001 From: etxhste@REDACTED (Hakan Stenholm) Date: Tue, 30 Jan 2001 17:47:50 +0100 (MET) Subject: Porting erlang to MacOS X ? Message-ID: <200101301647.RAA24145@avc240.etxb.ericsson.se> > Hello fellow erlangers! > > I have ported Erlang to MacOSX, quite easily, just hacking a bit in the > configure scripts. I have no numbers on performance yet, but it seems > reasonably fast. (My 266MHz G3 being on par with a 500MHz Pentium II > windows machine.) > > I am also experimenting with the graphical interface. As you know, MacOSX > doesn't use X-windows, instead it has a interface called Aqua, which is a > newer version of NextStep. I have two ways to use GUI on MacOSX: a > erl_interface-based module which can be used with the Interface Builder to > create a Mac GUI to an Erlang program; and an attempt to port gs, that > still has lots of work to be usable (i.e. good enough to run the debugger). I'm not a greate fan of gs - it's to slow and feature poor if you want to do any good UI (lacks gui widgets/components, drop & drag support) or animation (need double buffering support to do this flicker free), I would like to something more usefull. Does such a thing exist ? and does it use code (e.g. java byte code) that doesn't need to be recompiled for windows, mac, linux .... I think MacOSX has tcl/tk, I know that there was a version on classic macos - could that one be used or can etk use it, erlang seams to use it own (hacked ?) version of tlc/tk. Could one implement gs ontop of etk in that case. I my personal hobby project currently uses a prototyp gs based gui, but I intend to use java, esdl or some protable C(/C++ ...) based api. I've toyed with the idea to create a 'extended' gs with more features - based on some other graphis underpining than tk. > > Please let me know if anyone's interested, or willing to help. > I'll be happy to run this as my erlang platfrom at home and report/fix any strange bugs I find. > I'm planning to make an open source-release of OTP on MacOSX, after I've > tested it with the released MacOSX. > "released MacOSX" does that mean the final (non beta) version to be released 24/3 ? From bjowi@REDACTED Tue Jan 30 20:31:36 2001 From: bjowi@REDACTED (=?ISO-8859-1?Q?Bj=F6rn Wingman?=) Date: Tue, 30 Jan 2001 20:31:36 +0100 (MET) Subject: Event Channels Message-ID: <200101301931.UAA04612@proton.lysator.liu.se> How do I use the erlang event channels with another orb? In my idl I have a function that returns an CosEventChannelAdmin::EventChannel, but the 'OrberEventChannel_EventChannelFactory':create_event_channel/1 returns an object of type IDL:omg.org/OrberEventChannelAdmin/EventChannel:1.0 when I had expected IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0 I feel as if I'm missing some fundamental point here. /Bj?rn Wingman From voudheus@REDACTED Tue Jan 30 21:12:44 2001 From: voudheus@REDACTED (Karel Van Oudheusden) Date: Tue, 30 Jan 2001 21:12:44 +0100 Subject: shared memory in Erlang Message-ID: <3A77203C.DAE68BEB@imec.be> Hello, Are there Erlang compilers that support shared memory between processes? I do not really understand how database applications or network applications can be implemented in Erlang efficiently without some kind of form of shared memory. Only providing message passing does not seem to be a good choice for these kind of applications. Comparing Java with Erlang, I must conclude that Erlang is my first choice except for this very important memory issue! I would really appreciate a thorough answer or some links to this topic if possible. thank you in advance, KVO. From dg@REDACTED Tue Jan 30 22:33:23 2001 From: dg@REDACTED (David Gould) Date: Tue, 30 Jan 2001 13:33:23 -0800 Subject: shared memory in Erlang In-Reply-To: <3A77203C.DAE68BEB@imec.be>; from voudheus@imec.be on Tue, Jan 30, 2001 at 09:12:44PM +0100 References: <3A77203C.DAE68BEB@imec.be> Message-ID: <20010130133323.A5711@archimedes.oak.suse.com> On Tue, Jan 30, 2001 at 09:12:44PM +0100, Karel Van Oudheusden wrote: > Hello, > > > Are there Erlang compilers that support shared memory between processes? > > I do not really understand how database applications or network > applications can be implemented in Erlang efficiently without some kind > of form of shared memory. Only providing message passing does not seem > to be a good choice for these kind of applications. Erlang has a very strong process and communication model. I wonder what shared memory support between processes would look like in Erlang? I mean, what would the language need in terms of syntax and semantics to support it? I am having trouble picturing it fitting in without a great deal of collateral damage... Or do you mean, message passing implemented transparently by means of a shared memory? > Comparing Java with Erlang, I must conclude that Erlang is my first > choice except for this very important memory issue! But I certainly would not want to see Erlang become more like Java! -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 You left them alone in a room with a penguin?! Mr Gates, your men are already dead. From garry@REDACTED Tue Jan 30 22:33:55 2001 From: garry@REDACTED (Garry Hodgson) Date: Tue, 30 Jan 2001 16:33:55 -0500 Subject: enscript entry for erlang Message-ID: <3A773343.65571FF3@sage.att.com> has anyone built a description to allow the "enscript" utility to nicely format erlang programs? it doesn't appear in the enscript files distributed with redhat. -- Garry Hodgson Once in a while Senior Hacker you can get shown the light Software Innovation Services in the strangest of places AT&T Labs if you look at it right From scott@REDACTED Tue Jan 30 23:34:48 2001 From: scott@REDACTED (Scott Lystig Fritchie) Date: Tue, 30 Jan 2001 16:34:48 -0600 Subject: shared memory in Erlang In-Reply-To: Message of "Tue, 30 Jan 2001 13:33:23 PST." <20010130133323.A5711@archimedes.oak.suse.com> Message-ID: <200101302234.QAA89195@snookles.snookles.com> >>>>> "dg" == David Gould writes: dg> On Tue, Jan 30, 2001 at 09:12:44PM +0100, Karel Van Oudheusden wrote: >> Are there Erlang compilers that support shared memory between >> processes? If you mean between Erlang processes, the Binary data type is as close as you can currently get. ETS tables can be used by multiple processes (if created as a 'public' or 'protected' table), but its implementation makes copies of dg> I am having trouble picturing it fitting in without a great deal dg> of collateral damage... Assuming a "process" in this context is a UNIX, not Erlang, process.... I've dabbled with a hack that had all binary storage allocated from a shared memory segment. A new BIF would spit out the address and length of a binary. That address and size could be given to another UNIX process which had also mapped that memory region in the same manner. Heh. "Collateral damage" is a good phrase. There are several big problems with this hack. 1. Erlang's automatic memory management can reclaim a binary's memory and re-use it for something else, *before* the other UNIX process retrieved the data it wants from the shared memory buffer. A hack was to have an Erlang server process keep a reference to that binary, and when the other UNIX process was done with the shared memory buffer, it would signal back to the Erlang server to unreference the binary. 2. The Erlang VM was the sole owner of the shared memory region. No other UNIX process could allocate memory within it. To do otherwise was a good way to crash the VM. 3. An external UNIX process could violate Erlang's immutable data property: it could modify the contents of a binary object. This was half the reason for this hack in the first place, but it void's the Erlang warranty. :-) (Performance, by eliminating data copying, was the other reason.) I did that hack probably a year ago. I haven't returned to it, due to collater^Wsheer ugliness. Every now and then Ithink of it. But a few random thoughts every 6 months isn't enough to cook up reasonable semantics for this kind of thing, much less try to implement them. -Scott From alexis@REDACTED Tue Jan 30 23:54:08 2001 From: alexis@REDACTED (Alexis Le-Quoc) Date: Tue, 30 Jan 2001 17:54:08 -0500 (EST) Subject: Curious behaviour of gen_tcp Message-ID: Hello everyone, I'm using the following program structure to have an erlang process communicate with a socket based server (written in perl). The code is simplified on purpose. start() -> loop_idle(). loop_idle(Queue) case not_empty(Queue) of true -> send_and_loop(Queue); _ -> do_nothing end; receive {send, Data} -> send_and_loop(Data); _ -> log_crap end. send_and_loop(Queue) -> {ok, Socket} = gen_tcp:connect("localhost", 1, [binary, {packet, 0}]), gen_tcp:send(Socket, Queue:pop()), loop_busy(Queue, Socket, <<>>). loop_busy(Queue, Socket, Buffer) -> receive {tcp, Socket, Data} -> loop_busy(Socket, concat_binary([Buffer, Data]); {tcp_closed, Socket} -> io:fwrite("Finished ~w", [length(binary_to_list(Buffer)]), loop_idle(Queue); Any -> io:fwrite("Received ~w~n", [Any]) end. %%%%%%%%%%%%% This works great except that for responses bigger than 70 KB, I don't get consistent results, i.e. sometimes, the response received by erlang is about the right size (compared to what was sent by the server, always the same size), sometimes, it's half or a quarter of the size. Am I correct in assuming that the {tcp_closed..} pattern does not necessarily match after {tcp, Socket, Data}? I.e. the process will match some {tcp, Socket, Data} and then, if {tcp_closed...} has been received, it *can* match it and exit the loop *while* there are still {tcp, Socket, Data} messages in its mailbox. If this is correct, does it mean that I need to spawn a listener process which will do gen_tcp:recv() and notify the parent that it has received all data? I have to say I'm a bit boggled by this one. Alexis From klacke@REDACTED Wed Jan 31 00:04:53 2001 From: klacke@REDACTED (Klacke) Date: Wed, 31 Jan 2001 00:04:53 +0100 Subject: shared memory in Erlang In-Reply-To: <20010130133323.A5711@archimedes.oak.suse.com>; from dg@suse.com on Tue, Jan 30, 2001 at 01:33:23PM -0800 References: <3A77203C.DAE68BEB@imec.be> <20010130133323.A5711@archimedes.oak.suse.com> Message-ID: <20010131000453.C24054@bluetail.com> On Tue, Jan 30, 2001 at 01:33:23PM -0800, David Gould wrote: > On Tue, Jan 30, 2001 at 09:12:44PM +0100, Karel Van Oudheusden wrote: > > Hello, > > > > > > Are there Erlang compilers that support shared memory between processes? > > > > I do not really understand how database applications or network > > applications can be implemented in Erlang efficiently without some kind > > of form of shared memory. Only providing message passing does not seem > > to be a good choice for these kind of applications. > > Erlang has a very strong process and communication model. I wonder what > shared memory support between processes would look like in Erlang? I mean, > what would the language need in terms of syntax and semantics to support it? > I've fiddled with shared memory between different erlang nodes on the same machine. A master node and a bunch of slave nodes, 1. Master node creates segment initiall with shmget() in a linked in driver. 2. Slave node attach to the segment. 3. Spinlocks in the segment itself to ensure exclusivity. We (have used it (and dropped it)) to store SSL cached sesions and share them between several erlang nodes on the smae machine. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke -- From andrew@REDACTED Tue Jan 30 23:35:08 2001 From: andrew@REDACTED (Andrew Wallace) Date: Wed, 31 Jan 2001 09:35:08 +1100 Subject: shared memory in Erlang References: <3A77203C.DAE68BEB@imec.be> <20010130133323.A5711@archimedes.oak.suse.com> Message-ID: <3A77419C.74423DBE@lodbroker.com> David Gould wrote: > > On Tue, Jan 30, 2001 at 09:12:44PM +0100, Karel Van Oudheusden wrote: > > Hello, > > > > > > Are there Erlang compilers that support shared memory between processes? > > > > I do not really understand how database applications or network > > applications can be implemented in Erlang efficiently without some kind > > of form of shared memory. Only providing message passing does not seem > > to be a good choice for these kind of applications. > > Erlang has a very strong process and communication model. I wonder what > shared memory support between processes would look like in Erlang? Karel might be talking about internal sharing memory between processes which I find hard to picture in Erlang, ets tables maybe? We've also thought about implementing shared memory for communication between Erlang and the rest of the world. If the external (non-Erlang) stuff wrote to the shared memory buffer and Erlang could read from it when it needed the data. (Or it could go the other way around.) > I mean, > what would the language need in terms of syntax and semantics to support it? > Nothing special, some understanding of normal data structures. It wouldn't have to be too complicated. Cheers, Andrew > I am having trouble picturing it fitting in without a great deal of > collateral damage... > > Or do you mean, message passing implemented transparently by means of a > shared memory? > > > Comparing Java with Erlang, I must conclude that Erlang is my first > > choice except for this very important memory issue! > > But I certainly would not want to see Erlang become more like Java! > > -dg > > -- > David Gould dg@REDACTED > SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 > You left them alone in a room with a penguin?! Mr Gates, your men are > already dead. From jim@REDACTED Wed Jan 31 01:50:32 2001 From: jim@REDACTED (Jim Larson) Date: Tue, 30 Jan 2001 16:50:32 -0800 Subject: shared memory in Erlang In-Reply-To: Your message of "Tue, 30 Jan 2001 21:12:44 +0100." <3A77203C.DAE68BEB@imec.be> Message-ID: <200101310050.QAA95000@functor.Sendmail.COM> In message <3A77203C.DAE68BEB@REDACTED> Karel Van Oudheusden writes: >Are there Erlang compilers that support shared memory between processes? I can interpret your question in one of three ways: 1) "Are there Erlang implementations that allow you to send some data between Erlang processes on the same Erlang node without copying?" Yes - in Open-Source Erlang, binary-type data is passed by reference in messages. 2) "Are there Erlang implementations that pass *all* data between Erlang processes without copying?" Not to my knowledge. Although the functional properties of Erlang should allow such an implementation, I don't think it's desirable for two reasons: - it would imply a single global heap, or massive synchronization between per-process heaps, which would prevent independent per-process GC, which would hurt Erlang's soft real-time properties; - I recall hearing that the overhead of message passing within an Erlang node is high enough that the cost of copying message data isn't overwhelming, for typically-sized messages. 3) "Are there Erlang implementations that allow shared memory IPC between and Erlang node and another OS process?" Depending on your needs, you might be able to create a special-purpose linked-in driver that can transform messages into shared-memory updates, and vice-versa. Using this mechanism, you incur an overhead in copying data, even from binaries, into the shared memory, and vice-versa. Scott Lystig Fritchie implemented hacks to R6B that put all of Erlang's binaries in a shared-memory space, so that bulk data received from the network could be processed by Erlang code and sent to another C application, with zero-copy overhead. Unfortunately, the performance wasn't as great as we'd hoped, possibly due to the locking overheads of the shared-memory malloc() library we needed to use. >I do not really understand how database applications or network >applications can be implemented in Erlang efficiently without some kind >of form of shared memory. Only providing message passing does not seem >to be a good choice for these kind of applications. I don't understand your concern here. Shared memory is only useful for communicating with other OS processes on the same host, so you're either having to integrate with applications written in other languages, or perhaps take advantage of a multiprocessor through running several Erlang nodes on the same host. Other than that, network and database applications seem to work fine in Erlang. Jim From dg@REDACTED Wed Jan 31 02:19:22 2001 From: dg@REDACTED (David Gould) Date: Tue, 30 Jan 2001 17:19:22 -0800 Subject: shared memory in Erlang In-Reply-To: <200101310050.QAA95000@functor.Sendmail.COM>; from jim@sendmail.com on Tue, Jan 30, 2001 at 04:50:32PM -0800 References: <3A77203C.DAE68BEB@imec.be> <200101310050.QAA95000@functor.Sendmail.COM> Message-ID: <20010130171922.B6028@archimedes.oak.suse.com> On Tue, Jan 30, 2001 at 04:50:32PM -0800, Jim Larson wrote: > >I do not really understand how database applications or network > >applications can be implemented in Erlang efficiently without some kind > >of form of shared memory. Only providing message passing does not seem > >to be a good choice for these kind of applications. > > I don't understand your concern here. Shared memory is only useful > for communicating with other OS processes on the same host, so > you're either having to integrate with applications written in > other languages, or perhaps take advantage of a multiprocessor > through running several Erlang nodes on the same host. Other than > that, network and database applications seem to work fine in Erlang. As a database engine guy in a former life, I think I do understand. Basically database engines run as a collection of processes (one per physical CPU) sharing a common set of datastructures: the database page cache database metadata (table names, schema definitions, procedure defs etc) lock manager tables transaction / logging information scheduler information thread data including execution stacks The database engines typically implement their own lightweight threading (somewhat akin to Erlang processes), and are able to schedule threads across multiple physical CPUs. That is, threads can migrate. So there is not any local data, everything is in the shared memory, even if it is private to a thread because that thread may next be scheduled onto a different process/cpu. It does not really look easy to build such a thing in Erlang. Possibly a linked in driver could provide a suffcient interface to the critical parts, eg lock manager, page cache, page qualification (get rows on this page that match a predicate), page update etc. Indeed, such a beast might be much cleaner and more stable than existing db systems because of the enforced strict isolation of the shared memory behind a defined interface (ie, no random pointer poking). Interesting project for someone with a big need for a high performance Erlang dbms. -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 You left them alone in a room with a penguin?! Mr Gates, your men are already dead. From jim@REDACTED Wed Jan 31 02:30:36 2001 From: jim@REDACTED (Jim Larson) Date: Tue, 30 Jan 2001 17:30:36 -0800 Subject: shared memory in Erlang In-Reply-To: Your message of "Tue, 30 Jan 2001 17:19:22 PST." <20010130171922.B6028@archimedes.oak.suse.com> Message-ID: <200101310130.RAA95178@functor.Sendmail.COM> In message <20010130171922.B6028@REDACTED> David Gould writes: >It does not really look easy to build such a thing in Erlang. Possibly >a linked in driver could provide a suffcient interface to the critical >parts, eg lock manager, page cache, page qualification (get rows on this >page that match a predicate), page update etc. > >Indeed, such a beast might be much cleaner and more stable than existing >db systems because of the enforced strict isolation of the shared memory >behind a defined interface (ie, no random pointer poking). Interesting >project for someone with a big need for a high performance Erlang dbms. It sounds like what's *really* desired here is a multiprocessor-friendly implementation of Erlang, so that a single Erlang node could use several CPUs on an SMP at once. (In fact, Erlang is probably a nice fit to NUMA architecutres too, not just SMP.) Jim From dg@REDACTED Wed Jan 31 02:56:35 2001 From: dg@REDACTED (David Gould) Date: Tue, 30 Jan 2001 17:56:35 -0800 Subject: shared memory in Erlang In-Reply-To: <200101310130.RAA95178@functor.Sendmail.COM>; from jim@sendmail.com on Tue, Jan 30, 2001 at 05:30:36PM -0800 References: <20010130171922.B6028@archimedes.oak.suse.com> <200101310130.RAA95178@functor.Sendmail.COM> Message-ID: <20010130175635.A6311@archimedes.oak.suse.com> On Tue, Jan 30, 2001 at 05:30:36PM -0800, Jim Larson wrote: > > It sounds like what's *really* desired here is a multiprocessor-friendly > implementation of Erlang, so that a single Erlang node could use > several CPUs on an SMP at once. Hmmm. What would be the benefit as opposed to multiple nodes on one SMP? Semantically Erlang makes it reasonably easy to ignore the node a process is on. So, presumably it would be a performance issue? But, since Erlang does not have large shared datastructures like a db engine, and would not let processes directly share them anyway, where is the performance gain of MP friendly Erlang going to come from? Message passing? More control of scheduling? Something else? The only one that comes to mind is message passing, in which case it would be possible to do a shared memory transport (as I think you mentioned doing). But any kind of sharing on an MP is going to involve some amount of overhead for spinlocks and other sychronization. This can eat most of the gains of an MP pretty fast. And MP friendly programs are much harder to debug for some kinds of bug. > (In fact, Erlang is probably a > nice fit to NUMA architecutres too, not just SMP.) I like this thought. Traditional MP programs are too tightly coupled to take good advantage of an MP. So they end up getting revamped with separate zoned memory allocators, and local copies of stuff. And lock contention becomes an even uglier headache than on an MP. Erlang, not being coupled at all, avoids all this, but presumably can take advantage of the low latency message that could be built for nodes on a NUMA. -dg -- David Gould dg@REDACTED SuSE, Inc., 580 2cd St. #210, Oakland, CA 94607 510.628.3380 You left them alone in a room with a penguin?! Mr Gates, your men are already dead. From nick@REDACTED Wed Jan 31 09:49:03 2001 From: nick@REDACTED (Niclas Eklund) Date: Wed, 31 Jan 2001 09:49:03 +0100 (MET) Subject: Event Channels In-Reply-To: <200101301931.UAA04612@proton.lysator.liu.se> Message-ID: Hello! OrberEventChannelAdmin::EventChannel inherrits the CosEventChannelAdmin::EventChannel interface. You can confirm this by invoking: corba_object:is_a(Channel,"IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0") You should consider to use the cosNotification application instead, which can do everything that cosEvent can and much more. For example, you can filter events, use QoS-settings etc etc. /Nick > How do I use the erlang event channels with another orb? In my idl I > have a function that returns an CosEventChannelAdmin::EventChannel, > but the 'OrberEventChannel_EventChannelFactory':create_event_channel/1 > returns an object of type > > IDL:omg.org/OrberEventChannelAdmin/EventChannel:1.0 > > when I had expected > > IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0 > > I feel as if I'm missing some fundamental point here. > > /Bj?rn Wingman From tobbe@REDACTED Wed Jan 31 10:10:32 2001 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: 31 Jan 2001 10:10:32 +0100 Subject: Curious behaviour of gen_tcp In-Reply-To: Alexis Le-Quoc's message of "Tue, 30 Jan 2001 17:54:08 -0500 (EST)" References: Message-ID: When doing pattern matching in a receive clause, Erlang takes the first message in the queue and tries to match it agains any of the receive clauses (in top-down order). See attached example. However, if this can happend in your gen_tcp case I don't know. Cheers /Tobbe %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -module(aa). -export([bb/0]). %%% %%% See how messages are received: %%% %%% 1> P=aa:bb(). %%% <0.28.0> %%% 2> P! tcp. %%% tcp %%% 3> P! tcp. %%% tcp %%% 4> P! tcp_closed. %%% tcp_closed %%% 5> P! tcp. %%% tcp %%% 6> P! tcp. %%% tcp %%% 7> P! start. %%% start %%% got tcp %%% got tcp %%% got tcp_closed %%% got tcp %%% got tcp %%% 8> %%% bb() -> spawn(fun() -> init() end). init() -> receive start -> true end, loop(). loop() -> receive tcp -> io:format("got tcp~n"), loop(); tcp_closed -> io:format("got tcp_closed~n"), loop() end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% From thomasl@REDACTED Wed Jan 31 10:21:28 2001 From: thomasl@REDACTED (Thomas Lindgren) Date: Wed, 31 Jan 2001 10:21:28 +0100 Subject: shared memory in Erlang In-Reply-To: <3A77203C.DAE68BEB@imec.be> (message from Karel Van Oudheusden on Tue, 30 Jan 2001 21:12:44 +0100) References: <3A77203C.DAE68BEB@imec.be> Message-ID: <200101310921.KAA00920@lammgam.bluetail.com> > I do not really understand how database applications or network > applications can be implemented in Erlang efficiently without some kind > of form of shared memory. Only providing message passing does not seem > to be a good choice for these kind of applications. Logically, the Erlang processes have private memories. In the implementation, there is some room to wiggle. In the Erlang/OTP implementation, all processes (in a single node) reside in the same address space (e.g., the same OS process). Some structures, such as binaries and ets-tables, are on the other hand normally shared by all processes. The Erlang emulator, compiler and runtime system ensure that everything is done properly (no wild writing to shared data, etc). But Erlang/OTP is just one data point. Another data point: it is possible to implement Erlang so that _no_ data are private (all processes share data arbitrarily); Robert Virding wrote such an implementation. The great problem then is memory management, which ended up costly in that implementation, but that might be solvable. (Erlang/OTP does not support sharing memory between nodes, however. At least as far as I know :-) Finally, what is your measure of efficiency? Our experience with a highly scalable mail frontend is that Erlang is _very_ good at handling large numbers of latency-insensitive concurrent sessions. On the other hand, latency-critical stuff (like, say, packet switching or digital signal processing) is probably better done in hardware, or perhaps assembly/C. In that case, use Erlang's concept of linked-in drivers to interface with this code. Thomas -- Thomas Lindgren thomas+junk@REDACTED Alteon WebSystems From etxuwig@REDACTED Wed Jan 31 10:36:02 2001 From: etxuwig@REDACTED (Ulf Wiger) Date: Wed, 31 Jan 2001 10:36:02 +0100 (MET) Subject: shared memory in Erlang In-Reply-To: <20010130171922.B6028@archimedes.oak.suse.com> Message-ID: On Tue, 30 Jan 2001, David Gould wrote: >On Tue, Jan 30, 2001 at 04:50:32PM -0800, Jim Larson wrote: > >> >I do not really understand how database applications or network >> >applications can be implemented in Erlang efficiently without some kind >> >of form of shared memory. Only providing message passing does not seem >> >to be a good choice for these kind of applications. >> >> I don't understand your concern here. Shared memory is only useful >> for communicating with other OS processes on the same host, so >> you're either having to integrate with applications written in >> other languages, or perhaps take advantage of a multiprocessor >> through running several Erlang nodes on the same host. Other than >> that, network and database applications seem to work fine in Erlang. > >As a database engine guy in a former life, I think I do understand. >Basically database engines run as a collection of processes (one per >physical CPU) sharing a common set of datastructures: > > the database page cache > database metadata (table names, schema definitions, procedure defs etc) > lock manager tables > transaction / logging information > scheduler information > thread data including execution stacks A few comments from my end: - There was an Erlang implementation with a global heap, called VEE, developed by Robert Virding. It used incremental GC, and did not copy messages. It didn't catch on though. Implementing message passing can of course be done transparently to erlang. One should also consider latency when dealing with message passing programs. - Implementing ets:insert and ets:lookup without copying could probably be done, but it's not obvious how it should be done. Apparently, experiments have been made with ets tables on the process heap, but this didn't turn out as well as expected (mainly due to GC.) The obvious problem with non-copying ets shows up when multiple processes update the same object; you would then need to keep and garbage collect the old object, if it is referenced by some process(es). Private ets tables could be implemented without copying, but for various reasons (mainly debugging), private ets tables are not used much. - The erlang processor, presented at EUC 2000, does not copy messages. The main thing wrong with the erlang processor at this time is that it is not ready yet. - There was also a multipro erlang implementation http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf Good reading for those who are interested. Demand for MP erlang was not high enough to warrant the extra effort needed to make it a product... at the time. - We (AXD 301) are discussing the idea of having a shared memory database that has erlang and C applications as clients. - We're also starting to look into a port of erlang to OSE/Delta (http://www.enea.com/PDF/rtk.pdf). We will at least study the possibility to make a native port, which maps erlang processes onto OSE threads. There are several good reasons to look into this. - I've also played with the idea of using something like Encore's Reflective Memory for really fast replication of process state between processors - distributed shared memory if you will. (http://www.encore.com/products/hardware/reflective/980012.shtml) It's not exactly clear to me if it could be reasonably well integrated into erlang, semantically, or if one would simply write a driver that interfaces to it. Our main problem with Encore's solution is that the memory size is too small for us. /Uffe -- Ulf Wiger tfn: +46 8 719 81 95 Senior System Architect mob: +46 70 519 81 95 Strategic Product & System Management ATM Multiservice Networks Data Backbone & Optical Services Division Ericsson Telecom AB From cahill@REDACTED Wed Jan 31 12:43:50 2001 From: cahill@REDACTED (Adrian John Cahill) Date: Wed, 31 Jan 2001 11:43:50 +0000 Subject: snmp agent -- Error status = noSuchName, index = 1. Message-ID: <3A77FA76.536EAC3E@ocean.ucc.ie> Hi, I am haing a bit of trouble with the snmp agent in Erlang. If i try to send a request to the agent, i get the following error: 3> snmp_mgr:gn([[1,3]]). ok * Got PDU: v1, CommunityName = "all-rights" *!*!* An error occured. *!*!* Error status = noSuchName, index = 1. Response, Request Id:79933850 [1,3] = 'NULL' I turned on verbose error messages in the agent window, and it displays the following error: ** SNMP NET-IF LOG: got paket from {127,0,0,1}:5000 ** SNMP NET-IF MPD LOG: v1, community: all-rights ** SNMP LOCAL-DB LOG: variable get: snmpEngineMaxMessageSize ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable -> first ** SNMP LOCAL-DB DEBUG: table next result: "127.0.0.1 v3" ** SNMP LOCAL-DB LOG: table get row: snmpTargetAddrTable -> "127.0.0.1 v3" ** SNMP LOCAL-DB DEBUG: table get row result: {"127.0.0.1 v3", [1,3,6,1,6,1,1], [127,0,0,1,19,136], 1500, 3, "std_trap", "target_v3", 3, 1, [], [], 2048} ** SNMP NET-IF MPD DEBUG: PDU type: 'get-next-request' ** SNMP NET-IF LOG: got pdu from {127,0,0,1}:5000 {pdu,'get-next-request', 79933850, noError, 0, [{varbind,[1,3],'NULL','NULL',1}]} ** SNMP MASTER-AGENT DEBUG: Received PDU {pdu,'get-next-request', 79933850, noError, 0, [{varbind,[1,3],'NULL','NULL',1}]} from {{127,0,0,1}, 5000} ** SNMP MASTER-AGENT ACM TRACE: check access for Pdu: {pdu,'get-next-request', 79933850, noError, 0, [{varbind,[1,3],'NULL','NULL',1}]} Security model: 1 Community: all-rights ** SNMP MASTER-AGENT ACM TRACE: View type: read ** SNMP LOCAL-DB LOG: table get row: snmpCommunityTable -> "all-rights" ** SNMP LOCAL-DB DEBUG: table get row result: {"all-rights", "all-rights", "all-rights", "sqlEngine", [], [], 3, 1} ** SNMP MASTER-AGENT ACM TRACE: get mib view Security name: "all-rights" Context name: [] ** SNMP LOCAL-DB LOG: table get row: intContextTable -> [] ** SNMP LOCAL-DB DEBUG: table get row result: undefined ** SNMP LOCAL-DB LOG: table get row: vacmSecurityToGroupTable -> [1, 10, 97, 108, 108, 45, 114, 105, 103, 104, 116, 115] ** SNMP LOCAL-DB DEBUG: table get row result: undefined ** SNMP MASTER-AGENT LOG: auth init check failed: noGroupName ** SNMP MASTER-AGENT DEBUG: Raw error status: authorizationError ** SNMP NET-IF LOG: reply pdu: {pdu,'get-response', 79933850, noSuchName, 1, [{varbind,[1,3],'NULL','NULL',1}]} ** SNMP LOCAL-DB LOG: variable get: snmpEngineMaxMessageSize ** SNMP NET-IF INFO: time in agent: 27993 mysec I noticed that it says target_v3, i have the agent set up for snmp v1, i have tried snmp v1&2&3 but i get the exact same error message. I do not know how to progress this any further, if anyone has any suggestions i would be delighted. Tia adrian From pekka@REDACTED Wed Jan 31 12:50:05 2001 From: pekka@REDACTED (Pekka Hedqvist) Date: Wed, 31 Jan 2001 12:50:05 +0100 Subject: shared memory in Erlang In-Reply-To: <20010130175635.A6311@archimedes.oak.suse.com> Message-ID: >-----Original Message----- >From: owner-erlang-questions@REDACTED >[mailto:owner-erlang-questions@REDACTED]On Behalf Of David Gould > >Message passing? In a way yes, msg-passing + context switch between two Erlang processes running on different nodes with shared mem (same physical machine) is way slower than if they ran in the same process space with either native threads or (preferably) worker threads scheduling Erlang processes. > >More control of scheduling? Yes, with the node modell one has to ensure that not all heavy Erlang processes ends on one node and the the lighter ones ends up on the other etc. With all processes scheduled within one process, either on native threads or with worker-model this is taken care automagically. > >Something else? >But any kind of sharing on an MP is going to involve some amount of >overhead for spinlocks and other sychronization. This can eat most of the >gains of an MP pretty fast. And MP friendly programs are much harder to >debug for some kinds of bug. The cost of locking really depends on the design of the runtime. The one Tony and I did many years back basically kept most of the original JAM/BEAM Erlang (multiple heaps, per-heap-gc, copying msg-passing, copying ets tables etc) characteristics, with a few tweaks though. There locking-bottlenecks would be hard to get even with many cpu:s. With a unified heap (VEE, or like some parallel prologs has and most Java runtimes has) things becomes more difficult and unpredictable. But the one we did mainly kept most of the good (and bad) things from the separate heaps (which todays Erlang still use) implementation but also took advantage of MP machines. I belive that a productified version of that one would given users few backlash-surprises, just run better on multiple CPU machines than any multi-Erlang-node aproach could ever do. Maybe obvious, but with an MP-Erlang the MP part would not be visible. Just plain ol'Erlang. >Erlang, not being coupled at all, avoids all this, but presumably can >take advantage of the low latency message that could be built for nodes >on a NUMA. BTW, improving Erlang-communication between nodes on the same machine and on separate machines can be done with new aproaches like VIA (www.viaarch.org). And new IO devices (NGIO etc). Erlang node communication on LAN/SAN:s with VIA could be really fast with via (avoiding tcp) etc and still portable. There is a free VIA around for Linux called M-VIA (http://www.nersc.gov/research/FTG/via/faq.html), but development around VIA does not happen as fast as I thought a few years back, but the basic ideas are just right (superfast direct userspace network IO, smart IO cards, portability etc) /pekka From micael.karlberg@REDACTED Wed Jan 31 13:17:18 2001 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Wed, 31 Jan 2001 13:17:18 +0100 Subject: snmp agent -- Error status = noSuchName, index = 1. References: <3A77FA76.536EAC3E@ocean.ucc.ie> Message-ID: <3A78024E.35A419F8@ericsson.com> What version of the agent are you using? /BMK Adrian John Cahill wrote: > > Hi, > I am haing a bit of trouble with the snmp agent in Erlang. If i try > to send a request to the agent, i get the following error: > 3> snmp_mgr:gn([[1,3]]). > ok > * Got PDU: v1, CommunityName = "all-rights" > *!*!* An error occured. *!*!* > Error status = noSuchName, index = 1. > Response, Request Id:79933850 > [1,3] = 'NULL' > > I turned on verbose error messages in the agent window, and it displays > the following error: > > ** SNMP NET-IF LOG: > got paket from {127,0,0,1}:5000 > ** SNMP NET-IF MPD LOG: > v1, community: all-rights > ** SNMP LOCAL-DB LOG: variable get: snmpEngineMaxMessageSize > ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable > ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable -> first > ** SNMP LOCAL-DB DEBUG: table next result: "127.0.0.1 v3" > ** SNMP LOCAL-DB LOG: table get row: snmpTargetAddrTable -> "127.0.0.1 > v3" > ** SNMP LOCAL-DB DEBUG: table get row result: {"127.0.0.1 v3", > [1,3,6,1,6,1,1], > [127,0,0,1,19,136], > 1500, > 3, > "std_trap", > "target_v3", > 3, > 1, > [], > [], > 2048} <--- snip ---> > I noticed that it says target_v3, i have the agent set up for snmp v1, i > have tried snmp v1&2&3 but i get the exact same error message. > I do not know how to progress this any further, if anyone has any > suggestions i would be delighted. The "127.0.0.1 v3" is read from the target_addr.conf file The "target_v3" is read from the target_params.conf file. These are just names you have selected. You can call them anything you like (but not ""). > Tia > adrian -- Micael Karlberg Ericsson Utvecklings AB, ?lvsj?, Sweden Tel: +46 8 727 5668 Mail: micael.karlberg@REDACTED Fax: +46 8 727 5668 From micael.karlberg@REDACTED Wed Jan 31 13:31:56 2001 From: micael.karlberg@REDACTED (Micael Karlberg) Date: Wed, 31 Jan 2001 13:31:56 +0100 Subject: snmp agent -- Error status = noSuchName, index = 1. References: <3A77FA76.536EAC3E@ocean.ucc.ie> Message-ID: <3A7805BC.93FE97EA@ericsson.com> What does your vacm.conf file look like? /BMK Adrian John Cahill wrote: > > Hi, > I am haing a bit of trouble with the snmp agent in Erlang. If i try > to send a request to the agent, i get the following error: > 3> snmp_mgr:gn([[1,3]]). > ok > * Got PDU: v1, CommunityName = "all-rights" > *!*!* An error occured. *!*!* > Error status = noSuchName, index = 1. > Response, Request Id:79933850 > [1,3] = 'NULL' > > I turned on verbose error messages in the agent window, and it displays > the following error: > > ** SNMP NET-IF LOG: > got paket from {127,0,0,1}:5000 > ** SNMP NET-IF MPD LOG: > v1, community: all-rights > ** SNMP LOCAL-DB LOG: variable get: snmpEngineMaxMessageSize > ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable > ** SNMP LOCAL-DB LOG: table next: snmpTargetAddrTable -> first > ** SNMP LOCAL-DB DEBUG: table next result: "127.0.0.1 v3" > ** SNMP LOCAL-DB LOG: table get row: snmpTargetAddrTable -> "127.0.0.1 > v3" > ** SNMP LOCAL-DB DEBUG: table get row result: {"127.0.0.1 v3", > [1,3,6,1,6,1,1], > [127,0,0,1,19,136], > 1500, > 3, > "std_trap", > "target_v3", > 3, > 1, > [], > [], > 2048} > ** SNMP NET-IF MPD DEBUG: PDU type: 'get-next-request' > ** SNMP NET-IF LOG: > got pdu from {127,0,0,1}:5000 {pdu,'get-next-request', > 79933850, > noError, > 0, > [{varbind,[1,3],'NULL','NULL',1}]} > > ** SNMP MASTER-AGENT DEBUG: > Received PDU {pdu,'get-next-request', > 79933850, > noError, > 0, > [{varbind,[1,3],'NULL','NULL',1}]} from > {{127,0,0,1}, > 5000} > ** SNMP MASTER-AGENT ACM TRACE: check access for > Pdu: {pdu,'get-next-request', > 79933850, > noError, > 0, > [{varbind,[1,3],'NULL','NULL',1}]} > Security model: 1 > Community: all-rights > ** SNMP MASTER-AGENT ACM TRACE: View type: read > ** SNMP LOCAL-DB LOG: table get row: snmpCommunityTable -> "all-rights" > ** SNMP LOCAL-DB DEBUG: table get row result: {"all-rights", > "all-rights", > "all-rights", > "sqlEngine", > [], > [], > 3, > 1} > ** SNMP MASTER-AGENT ACM TRACE: get mib view > Security name: "all-rights" > Context name: [] > ** SNMP LOCAL-DB LOG: table get row: intContextTable -> [] > ** SNMP LOCAL-DB DEBUG: table get row result: undefined > ** SNMP LOCAL-DB LOG: table get row: vacmSecurityToGroupTable -> [1, > 10, > 97, > 108, > 108, > 45, > 114, > 105, > 103, > 104, > 116, > 115] > ** SNMP LOCAL-DB DEBUG: table get row result: undefined > ** SNMP MASTER-AGENT LOG: > auth init check failed: noGroupName > ** SNMP MASTER-AGENT DEBUG: > Raw error status: authorizationError > ** SNMP NET-IF LOG: > reply pdu: {pdu,'get-response', > 79933850, > noSuchName, > 1, > [{varbind,[1,3],'NULL','NULL',1}]} > ** SNMP LOCAL-DB LOG: variable get: snmpEngineMaxMessageSize > ** SNMP NET-IF INFO: time in agent: 27993 mysec > > I noticed that it says target_v3, i have the agent set up for snmp v1, i > have tried snmp v1&2&3 but i get the exact same error message. > I do not know how to progress this any further, if anyone has any > suggestions i would be delighted. > Tia > adrian -- Micael Karlberg Ericsson Utvecklings AB, ?lvsj?, Sweden Tel: +46 8 727 5668 Mail: micael.karlberg@REDACTED Fax: +46 8 727 5668 From Sean.Hinde@REDACTED Wed Jan 31 15:47:58 2001 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Wed, 31 Jan 2001 14:47:58 -0000 Subject: Curious behaviour of gen_tcp Message-ID: <402DD461F109D411977E0008C791C312039F5D0F@imp02mbx.one2one.co.uk> Hi, I don't know the answer to your question about whether it is possible to receive a tcp_closed before all the data is received from a socket, but another observation may be of interest. In R7B when you do concat_binary it will create a completely new binary. This means that every time you go round your loop and append a new bit of data you create a new copy of the entire buffer plus the new bit. This can very quickly chew up all your memory.. It is generally better for large amounts of data if you maintain a list of binaries and concatenate them in one go at the end. You can also use size/1 to get the size of a binary: loop_busy(Queue, Socket, Buffer) -> receive {tcp, Socket, Data} -> loop_busy(Socket, [Buffer, Data]); {tcp_closed, Socket} -> io:fwrite("Finished ~w", [size(concat_binary(Buffer))]), loop_idle(Queue); Any -> io:fwrite("Received ~w~n", [Any]) end. I'm not sure whether this behaviour changes in R8 with more support for segmented binaries... - Sean > -----Original Message----- > From: Alexis Le-Quoc [mailto:alexis@REDACTED] > Sent: 30 January 2001 22:54 > To: erlang-questions@REDACTED > Cc: prakash@REDACTED > Subject: Curious behaviour of gen_tcp > > > Hello everyone, > > I'm using the following program structure to have an erlang process > communicate with a socket based server (written in perl). The code is > simplified on purpose. > > start() -> > loop_idle(). > > loop_idle(Queue) > case not_empty(Queue) of > true -> > send_and_loop(Queue); > _ -> > do_nothing > end; > > receive > {send, Data} -> > send_and_loop(Data); > _ -> > log_crap > end. > > send_and_loop(Queue) -> > {ok, Socket} = gen_tcp:connect("localhost", 1, [binary, > {packet, 0}]), > gen_tcp:send(Socket, Queue:pop()), > loop_busy(Queue, Socket, <<>>). > > loop_busy(Queue, Socket, Buffer) -> > receive > {tcp, Socket, Data} -> > loop_busy(Socket, concat_binary([Buffer, Data]); > {tcp_closed, Socket} -> > io:fwrite("Finished ~w", [length(binary_to_list(Buffer)]), > loop_idle(Queue); > Any -> > io:fwrite("Received ~w~n", [Any]) > end. > > %%%%%%%%%%%%% > > This works great except that for responses bigger than 70 KB, > I don't get > consistent results, i.e. sometimes, the response received by erlang is > about the right size (compared to what was sent by the > server, always the > same size), sometimes, it's half or a quarter of the size. > > Am I correct in assuming that the {tcp_closed..} pattern does not > necessarily match after {tcp, Socket, Data}? I.e. the process > will match > some {tcp, Socket, Data} and then, if {tcp_closed...} has > been received, > it *can* match it and exit the loop *while* there are still > {tcp, Socket, > Data} messages in its mailbox. > > If this is correct, does it mean that I need to spawn a > listener process > which will do gen_tcp:recv() and notify the parent that it > has received > all data? > > I have to say I'm a bit boggled by this one. > > Alexis > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From pekka@REDACTED Wed Jan 31 17:31:12 2001 From: pekka@REDACTED (Pekka Hedqvist) Date: Wed, 31 Jan 2001 17:31:12 +0100 Subject: shared memory in Erlang In-Reply-To: <20010130171922.B6028@archimedes.oak.suse.com> Message-ID: >-----Original Message----- >From: owner-erlang-questions@REDACTED >[mailto:owner-erlang-questions@REDACTED]On Behalf Of David Gould > >Message passing? In a way yes, msg-passing + context switch between two Erlang processes running on different nodes with shared mem (same physical machine) is way slower than if they ran in the same process space with either native threads or (preferably) worker threads scheduling Erlang processes. > >More control of scheduling? Yes, with the node modell one has to ensure that not all heavy Erlang processes ends on one node and the the lighter ones ends up on the other etc. With all processes scheduled within one process, either on native threads or with worker-model this is taken care automagically. > >Something else? >But any kind of sharing on an MP is going to involve some amount of >overhead for spinlocks and other sychronization. This can eat most of the >gains of an MP pretty fast. And MP friendly programs are much harder to >debug for some kinds of bug. The cost of locking really depends on the design of the runtime. The one Tony and I did many years back basically kept most of the original JAM/BEAM Erlang (multiple heaps, per-heap-gc, copying msg-passing, copying ets tables etc) characteristics, with a few tweaks though. There locking-bottlenecks would be hard to get even with many cpu:s. With a unified heap (VEE, or like some parallel prologs has and most Java runtimes has) things becomes more difficult and unpredictable. But the one we did mainly kept most of the good (and bad) things from the separate heaps (which todays Erlang still use) implementation but also took advantage of MP machines. I belive that a productified version of that one would given users few backlash-surprises, just run better on multiple CPU machines than any multi-Erlang-node aproach could ever do. Maybe obvious, but with an MP-Erlang the MP part would not be visible. Just plain ol'Erlang. >Erlang, not being coupled at all, avoids all this, but presumably can >take advantage of the low latency message that could be built for nodes >on a NUMA. BTW, improving Erlang-communication between nodes on the same machine and on separate machines can be done with new aproaches like VIA (www.viaarch.org). And new IO devices (NGIO etc). Erlang node communication on LAN/SAN:s with VIA could be really fast with via (avoiding tcp) etc and still portable. There is a free VIA around for Linux called M-VIA (http://www.nersc.gov/research/FTG/via/faq.html), but development around VIA does not happen as fast as I thought a few years back, but the basic ideas are just right (superfast direct userspace network IO, smart IO cards, portability etc) /pekka From alexis@REDACTED Wed Jan 31 20:24:31 2001 From: alexis@REDACTED (=?iso-8859-1?Q?Alexis_L=EA-Qu=F4c?=) Date: Wed, 31 Jan 2001 14:24:31 -0500 Subject: Curious behaviour of gen_tcp In-Reply-To: <402DD461F109D411977E0008C791C312039F5D0F@imp02mbx.one2one.co.uk> Message-ID: Thanks again for all the quick responses. I've taken your advice by catenating binaries in one move. As far as the gen_tcp problem is concerned, I've tracked it down to the other process closing the connection before all data were sent. Thus the tcp_closed was received as I should have expected :-(. What works is to wait for some time before actually closing the socket at the server end (non-erlang). What does not is to remove that fix and have the server socket lingering on close. I have not found any way to set lingering options on an erlang socket. I'm still looking at the problem... Thank you again for the responses. Alexis -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Sean Hinde Sent: Wednesday, January 31, 2001 9:48 To: 'Alexis Le-Quoc'; erlang-questions@REDACTED Cc: prakash@REDACTED Subject: RE: Curious behaviour of gen_tcp Hi, I don't know the answer to your question about whether it is possible to receive a tcp_closed before all the data is received from a socket, but another observation may be of interest. In R7B when you do concat_binary it will create a completely new binary. This means that every time you go round your loop and append a new bit of data you create a new copy of the entire buffer plus the new bit. This can very quickly chew up all your memory.. It is generally better for large amounts of data if you maintain a list of binaries and concatenate them in one go at the end. You can also use size/1 to get the size of a binary: loop_busy(Queue, Socket, Buffer) -> receive {tcp, Socket, Data} -> loop_busy(Socket, [Buffer, Data]); {tcp_closed, Socket} -> io:fwrite("Finished ~w", [size(concat_binary(Buffer))]), loop_idle(Queue); Any -> io:fwrite("Received ~w~n", [Any]) end. I'm not sure whether this behaviour changes in R8 with more support for segmented binaries... - Sean > -----Original Message----- > From: Alexis Le-Quoc [mailto:alexis@REDACTED] > Sent: 30 January 2001 22:54 > To: erlang-questions@REDACTED > Cc: prakash@REDACTED > Subject: Curious behaviour of gen_tcp > > > Hello everyone, > > I'm using the following program structure to have an erlang process > communicate with a socket based server (written in perl). The code is > simplified on purpose. > > start() -> > loop_idle(). > > loop_idle(Queue) > case not_empty(Queue) of > true -> > send_and_loop(Queue); > _ -> > do_nothing > end; > > receive > {send, Data} -> > send_and_loop(Data); > _ -> > log_crap > end. > > send_and_loop(Queue) -> > {ok, Socket} = gen_tcp:connect("localhost", 1, [binary, > {packet, 0}]), > gen_tcp:send(Socket, Queue:pop()), > loop_busy(Queue, Socket, <<>>). > > loop_busy(Queue, Socket, Buffer) -> > receive > {tcp, Socket, Data} -> > loop_busy(Socket, concat_binary([Buffer, Data]); > {tcp_closed, Socket} -> > io:fwrite("Finished ~w", [length(binary_to_list(Buffer)]), > loop_idle(Queue); > Any -> > io:fwrite("Received ~w~n", [Any]) > end. > > %%%%%%%%%%%%% > > This works great except that for responses bigger than 70 KB, > I don't get > consistent results, i.e. sometimes, the response received by erlang is > about the right size (compared to what was sent by the > server, always the > same size), sometimes, it's half or a quarter of the size. > > Am I correct in assuming that the {tcp_closed..} pattern does not > necessarily match after {tcp, Socket, Data}? I.e. the process > will match > some {tcp, Socket, Data} and then, if {tcp_closed...} has > been received, > it *can* match it and exit the loop *while* there are still > {tcp, Socket, > Data} messages in its mailbox. > > If this is correct, does it mean that I need to spawn a > listener process > which will do gen_tcp:recv() and notify the parent that it > has received > all data? > > I have to say I'm a bit boggled by this one. > > Alexis > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information.