set_change_event() with nodb option - detect not working

Hi Reynald,


About the long time during the subscription, it could be due to the synchronous call happening at subscription time.


The work-around for this problem at my case is

- adding 192.168.0.100 my_computer_name
(at c:/windows/system32/drivers/etc/hosts)
- use TANGO_HOST => my_computer_name:10000

Then no more event heartbeat problem, and no more delay when calling subscribe_event().

I will stick to this setting for the time being.

Let me get back the second issue of device server stop problem when DEBUG mode (nodb option).


What would be interesting for us is to know the code executed when you read the attribute named E000095.

I tried run server program and client program side by side in one computer
And the TANGO_HOST is my_computer_name:10000
So, there's no mismatch between server and client side settings.


The time of this exception is

1. when client side run in "devapi_base.cpp" at
ret = api_ptr->get_zmq_event_consumer()->subscribe_event(this, attr_name,event, callback, filters, stateless);

call stack is
TOmronClient.exe!Tango::DeviceProxy::subscribe_event(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & attr_name="E000000.0", Tango::EventType event=CHANGE_EVENT, Tango::CallBack * callback=0x00000000030a6ba0, const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > & filters=[0](), bool stateless=false) 줄 7682 C++
TOmronClient.exe!Tango::DeviceProxy::subscribe_event(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & attr_name="E000000.0", Tango::EventType event=CHANGE_EVENT, Tango::CallBack * callback=0x00000000030a6ba0) 줄 842 + 0x40 바이트 C++
> TOmronClient.exe!subscribeEvent(Tango::DeviceProxy * device=0x00000000030a8ba0, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & attr_name="E000000.0", DoubleEventCallBack * double_callback=0x00000000030a6ba0) 줄 515 + 0x23 바이트 C++

2. Then the server program caught exception in "zmqeventsupplier.cpp" at
event_pub_sock->setsockopt(ZMQ_SNDHWM,&hwm,sizeof(hwm));

call stack is
TOmronServer.exe!_CxxThrowException(void * pExceptionObject=0x00000000045fb528, const _s__ThrowInfo * pThrowInfo=0x00007ff7547eb258) 줄 157 C++
TOmronServer.exe!zmq::socket_t::setsockopt(int option_=23, const void * optval_=0x00000000045fb6a8, unsigned __int64 optvallen_=4) 줄 243 C++
TOmronServer.exe!Tango::ZmqEventSupplier::create_event_socket() 줄 476 C++
> TOmronServer.exe!Tango::DServer::zmq_event_subscription_change(const Tango::DevVarStringArray * argin=0x0000000003077bb0) 줄 953 C++
TOmronServer.exe!Tango::ZmqEventSubscriptionChangeCmd::execute(Tango::DeviceImpl * device=0x000000000265ac50, const CORBA::Any & in_any={…}) 줄 1357 + 0x12 바이트 C++
TOmronServer.exe!Tango::DeviceClass::command_handler(Tango::DeviceImpl * device=0x000000000265ac50, std::basic_string<char,std::char_traits<char>,std::allocator<char> > & command="ZmqEventSubscriptionChange", const CORBA::Any & in_any={…}) 줄 1172 + 0x3e 바이트 C++

Refer to two captured images for the call stacks of the two programs


It would actually be interesting to know if it happens always on the same attribute.
Is your client trying to subscribe to thousands of attributes?

This happens at the first attempt of the looping.

try 
{
	cerr << "Fetching attribute name list " << pInfo->device->name() << " …" << endl;
	vector<string> *attribute_name_list = pInfo->device->get_attribute_list();
	cerr << "Attribute name size = " << attribute_name_list->size() << "." << endl;

	/* loop over all attributes */
	//====> size of attribues is from 200 to 1500
	for (int i=0; i<attribute_name_list->size(); i++)
	{
		// show progress
		cerr << ".";

		Tango::AttributeInfo ai = pInfo->device->get_attribute_config(attribute_name_list->at(i));

		// skip write-only attribute
		if (ai.writable == WRITE)
		{
			continue;
		}

		if ((ai.name == "State") || (ai.name == "Status"))
			continue;


		//====> below line causes server stop (when i == 0)
		int event_id = subscribeEvent(pInfo->device, ai.name, pInfo->double_callback);

		if (event_id >= 0)
			pInfo->event_ids.push_back(event_id);
	}

	cerr << "Connecting to device " << pInfo->device->name() << " done." << endl;

	return true;
}
catch (DevFailed &e) 
{ 
	Except::print_exception(e);
	return false;
}

How many threads do you have
how many attributes in the server
how many commands

The original server program has ten device patterns which inherit form one base pattern.
I'm testing by building 10 members under one class. (no database option)
And each device has
- from 200 to 1000 attributes
- 2 to 5 threads
- 10 commands

But for the testing purpose, I'm shrinking to
- one device
- one thread
- same command set


Are there any commands defined for this server?
Is the server throwing not-CORBA (not-TANGO) exceptions in these commands?
Is there a client executing commands?


Actually the client send Mode command to server before subscribing events.
And it passed without any problem.


Or could it be that when you read the E000095 attribute, this is executing a command?

I don't think this exception is coming by user defined command.

Hi,

It looks like you are using forbidden characters in your attribute name.
You have an attribute named "E000000.0".
I just tried to create a static attribute with this name with Pogo and it returns the following error:
Syntax error in name: Do not use '.' char.


It looks like Tango let you create an attribute with this name as dynamic attribute but since POGO doesn't let you name an attribute with a '.' char in it, I would really avoid to create attributes with special characters in their name.

Maybe the problem you are encountering is not linked to that but I would already start by changing that.

Happy to hear you found network settings that work in your case with (c:/windows/system32/drivers/etc/hosts). smile

Cheers,
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Reynald,

I think I found the right place to trigger the exception;

I thought the first exception caught by DevEnv was the place.
But I was wrong.

The place was at DServer::zmq_event_subscription_change(const Tango::DevVarStringArray *argin) in the eventcmds.cpp.

No database mode seems no alternative_event_endpoint().
So, get_alternate_event_endpoint() returns zero size vector.
And tmp_str = ev->get_alternate_event_endpoint()[loop]; => triggers exception.

The proper code should be

           if (ev->get_alternate_event_endpoint().size() != 0)
           {
                tmp_str = ev->get_alternate_event_endpoint()[loop];
                ret_data->svalue[((loop + 1) << 1) + 1] = CORBA::string_dup(tmp_str.c_str());
           }

The release mode?
It doesn't care I Think.

Sorry for the confusion that I posted previously.

Edited 7 years ago
Hello,

Well, that's clearly a bug in the Dserver::zmq_event_subscription_change code.
In the same method, there is similar code a bit above but the size of the vector is tested before accessing any of its elements. This is what should be done.
This is not crashing in release mode on Windows but I'm afraid this might corrupt the memory.
There might be some side effects… smile

Could you please create a ticket on https://sourceforge.net/p/tango-cs/bugs to keep track of this bug?
If you cannot or don't want to, I can create it. Just let me know.

This should be fixed in the next Tango release.
Thank you very much for reporting this.
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Reynald,

Please create a ticket for me.
Next time when I may find BUG like this, I'll do it by myself.smile
Here is the link to the ticket:
https://sourceforge.net/p/tango-cs/bugs/805
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
 
Register or login to create to post a reply.