hello,
while implementing distributed apps, i observed a behaviour that i can't
explain.
here's a simplified code that preserves the functionality needed to
reproduce the effect.
here is a simple server that collects messages from clients using a
stream and a port:
functor
import Connection Pickle System
define
Messages
MessagePort = {Port.new Messages}
proc {Post post(In Out)}
{Send MessagePort In}
Out = success end in
{Pickle.save {Connection.offerUnlimited Post} post}
for Message in Messages do {System.show Message} end
end
here is a simple client that sends a message to the server:
functor
import Connection Pickle Application System
define
Post = {Connection.take {Pickle.load post}}
Response = {Post post(hello $)} in
{Wait Response}
{System.show Response}
{Application.exit 0}
end
the code roughly corresponds to the examples from ch. 11 in ctmcp,
(e.g., sec. 11.3).
the server and the client are compiled. the server is started, and then
the client attempts to send a message, and exits afterwards; the server
does not display anything, and the process starts spinning (takes up all
cpu time) as soon as the client is dead.
if i add a delay to either the client code or the server code so that
the client has to wait a moment (say,10sec) before it terminates, the
message is displayed by the server, but then the server starts spinning
again after the client terminates. when the server is spinning,
starting a new client process blocks.
if i execute the client code (without the functor part) in an opi, all
works fine until i terminate the opi's oz process. then the server
starts spinning again. i can connect and successfully communicate with
the server again, even though it is spinning.
however, if the server is spinning after a command line client has
terminated, then a new opi client blocks as well. (but if there was an
opi client already connected when a cl client blocks, it is still able
to communicate with the server.)
what's the problem?
vQ
--
-------------------------------------------------------------------------------
Wacek Kusnierczyk, MD PhD
Email: [EMAIL PROTECTED]
Phone: +47 73591875, +47 72574609
Department of Computer and Information Science (IDI)
Faculty of Information Technology, Mathematics and Electrical Engineering (IME)
Norwegian University of Science and Technology (NTNU)
Sem Saelands vei 7, 7491 Trondheim, Norway
Room itv303
Bioinformatics & Gene Regulation Group
Department of Cancer Research and Molecular Medicine (IKM)
Faculty of Medicine (DMF)
Norwegian University of Science and Technology (NTNU)
Laboratory Center, Erling Skjalgsons gt. 1, 7030 Trondheim, Norway
Room 231.05.060
-------------------------------------------------------------------------------
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users