Frustration, Depression, Nastyness

Jens Grabarske grabarske at dfn-cert.de
Mon Jan 10 21:17:18 CET 2005


Hello, all!

It's 9pm and I'm still at work because my Oz does strange things.
Here's the thing:

In my architecture I have several clients waiting for a master thread to feed 
them stuff to do (distributed-programming-like).

The idea is that the master looks up some stuff in a database (using the 
postgres library that can be found in the contrib-directory) and generates 
closures for the clients to be executed by mapping a generator function over 
the data sets.

Now, the function that is supposed to generate the closures looks like this:

   fun {GenerateScanClosure ScanDS}
      fun {$ Command}
	 [CodeMOD] = {Module.link [ScanDS.code]}
      in
	 case Command
	 of start then
	    {CodeMOD.start ScanDS.argument ScanDS.ip}
	 [] tidy then {CodeMOD.tidy}
	 end
      end
   end

In my test situation, about 254 ScanDS structures are generated and passed to 
this function which generates 254 different functions. These functions are 
distributed to the clients. So far so good. The clients actually do execute 
254 functions. And the results of these 254 functions get collected. But in 
the end it turns out that all these 254 function calls yield the same result 
- because they operate on the same set of data! (as you can see, there is an 
IP address in the field "ip". This ip address should be different for all 254 
runs. But it's always the same).

When I let GenerateScanClosure print the IP address it receives, I get 254 
different IP addresses. So the problem has to be in the closure binding. I 
guess that it has to be some optimisation going wild and letting the bindings 
follow the "current" data set.

Does anyone see how I can make this work?

Kind regards,

Jens
-- 
Jens Grabarske (Research), DFN-CERT Services GmbH
https://www.dfn-cert.de, +49 40 808077-621 / +49 40 808077-555 (Hotline)

12. DFN-CERT Workshop und Tutorien, CCH Hamburg, 2-3. Maerz 2005
Infos/Anmeldung unter: https://www.dfn-cert.de/events/ws/2005/



More information about the mozart-users mailing list