Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-07-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Questions on the service implementation in Ice 1.3

Dear forum,

The thing I've been waiting for the most was the service implementation in the new version.
It's a rather elegant implementation, so thanks a lot!

What I tried at first was an implementation independent of Ice, i.e. simply writing some random stuff to a file.
What I discovered was that, when I compiled the program in debug mode (VS 7.0), I get an error _CrtCheckMemory(), i.e. in the malloc debugger. I hope that this error isn't created by me and you'll be able to reproduce it. If not, I would re-create my simple example.
btw: When compiling in release mode, everything works really smooth!

An other question that arised when taking a look at the service implementation: Before I was using the standard Ice::Application interface and had a while() loop (checking for interrupted() periodically) which called some functions on my server object which need to be called periodically as well. As I now only have a start() function I can overwrite and no run() function, what is your suggestion for doing periodic calls to an object from within a service? I created a separate thread in start() which does the job for me but I asked myself whether you have a better idea!

regs,

Stephan

P.S.: One suggestion for the next releases: Can't you please implement two pure virtual functions to the interface of Ice::Service named serviceLabel() and serviceName() which need to be overwritten for implementations? This would simplify the call to
myservice.exe --install "servicelabel"
to
myservice.exe --install
since the name of the service is 'known' by the implementation!
This would be similar to the implementation that Trolltech chose within the Qt solutions library (http://doc.trolltech.com/solutions/qtservice/qtservice.html )
Reply With Quote
  #2 (permalink)  
Old 03-08-2004
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Re: Questions on the service implementation in Ice 1.3

Hi Stephan,

Quote:
Originally posted by stephan
The thing I've been waiting for the most was the service implementation in the new version.
It's a rather elegant implementation, so thanks a lot!
Thanks!
Quote:
What I tried at first was an implementation independent of Ice, i.e. simply writing some random stuff to a file.
What I discovered was that, when I compiled the program in debug mode (VS 7.0), I get an error _CrtCheckMemory(), i.e. in the malloc debugger. I hope that this error isn't created by me and you'll be able to reproduce it. If not, I would re-create my simple example.
btw: When compiling in release mode, everything works really smooth!
This is the expected result if you try mixing code built using the debug and release configurations.
Quote:
An other question that arised when taking a look at the service implementation: Before I was using the standard Ice::Application interface and had a while() loop (checking for interrupted() periodically) which called some functions on my server object which need to be called periodically as well. As I now only have a start() function I can overwrite and no run() function, what is your suggestion for doing periodic calls to an object from within a service? I created a separate thread in start() which does the job for me but I asked myself whether you have a better idea!
That sounds like a good approach to me.

Quote:
P.S.: One suggestion for the next releases: Can't you please implement two pure virtual functions to the interface of Ice::Service named serviceLabel() and serviceName() which need to be overwritten for implementations? This would simplify the call to
myservice.exe --install "servicelabel"
to
myservice.exe --install
since the name of the service is 'known' by the implementation!
This would be similar to the implementation that Trolltech chose within the Qt solutions library (http://doc.trolltech.com/solutions/qtservice/qtservice.html )
Thanks for the suggestion, we'll probably do something similar for the next release.

Take care,
- Mark
Reply With Quote
  #3 (permalink)  
Old 03-08-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Re: Re: Questions on the service implementation in Ice 1.3

Hey!

Quote:
Originally posted by mes

This is the expected result if you try mixing code built using the debug and release configurations.
Yes that was what I thought in the first place. But I'm linking against iced.lib/ iceUtild.lib (I installed the prebuild VS7.0 package) in my VS debug configuration. So this should be clean.

regs,

Stephan
Reply With Quote
  #4 (permalink)  
Old 03-08-2004
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 817
Hi Stephan,

/MD vs /MDd is more correct than release vs debug.

Since you're linking with the *d.lib Ice libraries, check that
Project->Properties->C/C++/Code Generation: Runtime Library is 'Multi-threaded Debug DLL (/MDd)'.

Also, if you are using icebox, the /MDd icebox is in %ICE_HOME%/bin/debug.

Cheers,
Bernard
Reply With Quote
  #5 (permalink)  
Old 03-08-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Quote:

/MD vs /MDd is more correct than release vs debug.
Sorry for the inprecision. I used /MDd.
However, in the meantime I probably discovered where the error comes from. I did a service implementation from scratch which almost worked. But as soon I created a separate thread where I initialized a new communicator, I received the malloc debugger error.

But the problem doesn't seem to come from the malloc debugger or ICE itself but rather from what I coded:


int argc = 0;
char** argv = 0;

Ice::CommunicatorPtr comm = Ice::initialize(argc, argv);


If I set argc = 1 and initialize argv, everything works well :-)

What I would like to suggest is to implement a check for this. I think this would make a lot of sense because I don't have (and don't need....) argc and argv my separate thread.

regs,

Stephan
Reply With Quote
  #6 (permalink)  
Old 03-08-2004
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi Stephan,

Can you provide a simple example that reproduces this problem? I wasn't able to reproduce it.

Out of curiosity, why do you need to create another communicator?

- Mark
Reply With Quote
  #7 (permalink)  
Old 03-09-2004
stephan stephan is offline
Registered User
 
Name: Stephan Stapel
Organization: Stephan Stapel
Project: BristolNG
 
Join Date: Oct 2003
Location: Essen, Germany
Posts: 169
Hi!

Quote:
Out of curiosity, why do you need to create another communicator?
hmm. Sorry for my nescience but is it allowed to share a single communicator between two threads, i.e. to pass a CommunicatorPtr to the thread?! I thought it would be cleaner to create a separate communicator handle in each thread?

regs,

Stephan
Reply With Quote
  #8 (permalink)  
Old 03-09-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
Ice is fully thread-safe, meaning that you can share everything between threads, not just the communicator.

You definitely should share the communicator between threads, otherwise each thread will use its own set of outgoing connections.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Program implementation / File Transfer Questions (yes, i have read the faq :) )/ Ruby EmmanuelOga Help Center 2 08-01-2006 06:58 PM
ServantLocator implementation DeepDiver Help Center 10 06-16-2005 10:50 AM
Error in service implementation stephan Bug Reports 3 04-14-2004 03:05 PM
Service implementation comment stephan Comments 2 03-30-2004 02:27 AM
C# implementation issues? vukicevic Comments 5 02-11-2004 04:46 PM


All times are GMT -4. The time now is 11:06 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.