diff -Naur '--exclude=.svn' tango_805/lib/cpp/client/dbapi_base.cpp tango_805.p1/lib/cpp/client/dbapi_base.cpp
--- tango_805/lib/cpp/client/dbapi_base.cpp	2012-07-04 08:41:15.228010245 +0200
+++ tango_805.p1/lib/cpp/client/dbapi_base.cpp	2012-09-10 14:22:30.408531752 +0200
@@ -733,7 +733,7 @@
 	{
 		ostream << (*db_info_list)[i].in() << endl;
 	}
-	ostream << ends;
+
 	string ret_str = ostream.str();
 
 	return(ret_str);
@@ -3808,18 +3808,23 @@
 	DbServerCache *dsc;
 	if (au->in_server() == true)
 	{
-		try
-		{
-			Tango::Util *tg = Tango::Util::instance(false);
-			dsc = tg->get_db_cache();
-		}
-		catch (Tango::DevFailed &e)
+		if (from_env_var == false)
+			dsc = NULL;
+		else
 		{
-            string reason = e.errors[0].reason.in();
-            if (reason == "API_UtilSingletonNotCreated" && ext->db_tg != NULL)
-                dsc = ext->db_tg->get_db_cache();
-            else
-                dsc = NULL;
+			try
+			{
+				Tango::Util *tg = Tango::Util::instance(false);
+				dsc = tg->get_db_cache();
+			}
+			catch (Tango::DevFailed &e)
+			{
+				string reason = e.errors[0].reason.in();
+				if (reason == "API_UtilSingletonNotCreated" && ext->db_tg != NULL)
+					dsc = ext->db_tg->get_db_cache();
+				else
+					dsc = NULL;
+			}
 		}
 	}
 	else
diff -Naur '--exclude=.svn' tango_805/lib/cpp/client/dbapi_datum.cpp tango_805.p1/lib/cpp/client/dbapi_datum.cpp
--- tango_805/lib/cpp/client/dbapi_datum.cpp	2012-07-04 08:41:15.228010245 +0200
+++ tango_805.p1/lib/cpp/client/dbapi_datum.cpp	2012-09-10 14:21:56.340340411 +0200
@@ -77,6 +77,11 @@
 
 DbDatum::~DbDatum()
 {
+#ifndef HAS_UNIQUE_PTR
+	#ifndef _TG_WINDOWS_
+    delete ext;
+    #endif
+#endif
 }
 
 //-----------------------------------------------------------------------------
diff -Naur '--exclude=.svn' tango_805/lib/cpp/client/proxy_asyn.cpp tango_805.p1/lib/cpp/client/proxy_asyn.cpp
--- tango_805/lib/cpp/client/proxy_asyn.cpp	2012-07-04 08:41:15.232010259 +0200
+++ tango_805.p1/lib/cpp/client/proxy_asyn.cpp	2012-09-10 14:22:40.868591061 +0200
@@ -380,8 +380,8 @@
 
 //
 // Check if the exception was a connection exception
-// In this case, try to ping the device.
-// If successfull, just returns otherwise, throw the first exception
+// If so, execute the command synchronously (tries to reconnect)
+// If successful just return, otherwise throw the first exception
 //
 
 			string ex(cb_excep_mess);
@@ -390,14 +390,6 @@
 			{
 				try
 				{
-					DeviceProxy *dev_ptr = static_cast<DeviceProxy *>(this);
-					dev_ptr->ping();
-
-//
-// If we arrive here, this means we have to do a re-try with a synchronous
-// request
-//
-
 					DeviceData dd_out = redo_synch_cmd(req);
 
 //
@@ -502,15 +494,16 @@
 
 		for (i = 0;i < nb;i++)
 		{
+			if (req.request->poll_response() == true)
+			{
+				break;
+			}
+
 #ifdef _TG_WINDOWS_
 			Sleep(20);
 #else
 			nanosleep(&to_wait,&inter);
 #endif
-			if (req.request->poll_response() == true)
-			{
-				break;
-			}
 		}
 
 		if (i == nb)
@@ -626,7 +619,7 @@
 			set_connection_state(CONNECTION_NOTOK);
 
 //
-// Re-throw all CORBA system exceptions
+// Re-throw nearly all CORBA system exceptions
 //
 
 			CORBA::NVList_ptr req_arg = req.request->arguments();
@@ -637,6 +630,34 @@
 
 			char *cb_excep_mess = Tango::Except::print_CORBA_SystemException(sys_ex);
 
+//
+// Check if the exception was a connection exception
+// If so, execute the command synchronously (tries to reconnect)
+// If successful just return, otherwise throw the first exception
+//
+
+			string ex(cb_excep_mess);
+			string::size_type pos = ex.find("TRANSIENT_ConnectFailed");
+			if (pos != string::npos)
+			{
+				try
+				{
+					DeviceData dd_out = redo_synch_cmd(req);
+
+//
+// Remove request from request global table.
+//
+
+					CORBA::string_free(tmp);
+
+					remove_asyn_request(id);
+
+					return dd_out;
+
+				}
+				catch (Tango::DevFailed &) {}
+			}
+
 			TangoSys_OMemStream desc;
 			desc << "Failed to execute command_inout_asynch on device " << dev_name();
 			desc << ", command " << tmp << ends;
diff -Naur '--exclude=.svn' tango_805/lib/cpp/server/dev_poll.cpp tango_805.p1/lib/cpp/server/dev_poll.cpp
--- tango_805/lib/cpp/server/dev_poll.cpp	2012-07-04 08:41:29.424059013 +0200
+++ tango_805.p1/lib/cpp/server/dev_poll.cpp	2012-09-10 14:22:12.612432018 +0200
@@ -324,6 +324,13 @@
 {
     Tango::Util *tg = Tango::Util::instance();
 
+	if (tg->is_svr_shutting_down() == true)
+	{
+		Except::throw_exception((const char *)"API_NotSupported",
+								(const char *)"It's not supported to start polling on any device cmd/attr while the device is shutting down",
+								(const char *)"DeviceImpl::poll_object");
+	}
+
     if (tg->is_svr_starting() == true)
     {
 
@@ -550,30 +557,34 @@
     else
     {
 
+		if (tg->is_device_restarting(device_name) == false)
+		{
+
 //
 // Ask the admin device to do the work (simulating the classical
 // way to tune polling)
 //
 
-        DServer *ds = tg->get_dserver_device();
-        CORBA::Any the_any;
+			DServer *ds = tg->get_dserver_device();
+			CORBA::Any the_any;
 
-        DevVarStringArray *send = new DevVarStringArray();
-        send->length(3);
+			DevVarStringArray *send = new DevVarStringArray();
+			send->length(3);
 
-        (*send)[0] = CORBA::string_dup(get_name().c_str());
-        if (type == POLL_CMD)
-            (*send)[1] = CORBA::string_dup("command");
-        else
-            (*send)[1] = CORBA::string_dup("attribute");
-        (*send)[2] = CORBA::string_dup(obj_name.c_str());
-
-        the_any <<= send;
-
-        CORBA::Any *received_any;
-
-        received_any = ds->command_inout("RemObjPolling",the_any);
-        delete received_any;
+			(*send)[0] = CORBA::string_dup(get_name().c_str());
+			if (type == POLL_CMD)
+				(*send)[1] = CORBA::string_dup("command");
+			else
+				(*send)[1] = CORBA::string_dup("attribute");
+			(*send)[2] = CORBA::string_dup(obj_name.c_str());
+
+			the_any <<= send;
+
+			CORBA::Any *received_any;
+
+			received_any = ds->command_inout("RemObjPolling",the_any);
+			delete received_any;
+		}
     }
 }
 
diff -Naur '--exclude=.svn' tango_805/lib/cpp/server/dserver.cpp tango_805.p1/lib/cpp/server/dserver.cpp
--- tango_805/lib/cpp/server/dserver.cpp	2012-07-04 08:41:29.436059055 +0200
+++ tango_805.p1/lib/cpp/server/dserver.cpp	2012-09-10 14:22:12.612432018 +0200
@@ -940,6 +940,7 @@
 	DeviceImpl *new_dev = NULL;
 
 	vector<Tango::DeviceImpl *> &d_list = dev_cl->get_device_list();
+
 	for (i = 0;i < d_list.size();i++)
 	{
 		if (d_list[i]->get_name() == lower_d_name)
diff -Naur '--exclude=.svn' tango_805/lib/cpp/server/dserverpoll.cpp tango_805.p1/lib/cpp/server/dserverpoll.cpp
--- tango_805/lib/cpp/server/dserverpoll.cpp	2012-07-04 08:41:29.432059040 +0200
+++ tango_805.p1/lib/cpp/server/dserverpoll.cpp	2012-09-10 14:22:12.612432018 +0200
@@ -1338,97 +1338,102 @@
 //
 
 	PollingThreadInfo *th_info;
+	int poll_th_id;
 
-	int poll_th_id = tg->get_polling_thread_id_by_name((*argin)[0]);
-	if (poll_th_id == 0)
+	if (tg->is_svr_shutting_down() == false)
 	{
-		TangoSys_OMemStream o;
-		o << "Can't find a polling thread for device " << (*argin)[0] << ends;
-		Except::throw_exception((const char *)"API_NotSupported",o.str(),
-						(const char *)"DServer::rem_obj_polling");
-	}
+		poll_th_id = tg->get_polling_thread_id_by_name((*argin)[0]);
+		if (poll_th_id == 0)
+		{
+			TangoSys_OMemStream o;
+			o << "Can't find a polling thread for device " << (*argin)[0] << ends;
+			Except::throw_exception((const char *)"API_NotSupported",o.str(),
+							(const char *)"DServer::rem_obj_polling");
+		}
 
-	cout4 << "Thread in charge of device " << (*argin)[0] << " is thread " << poll_th_id << endl;
-	th_info = tg->get_polling_thread_info_by_id(poll_th_id);
+		cout4 << "Thread in charge of device " << (*argin)[0] << " is thread " << poll_th_id << endl;
+		th_info = tg->get_polling_thread_info_by_id(poll_th_id);
 
 //
 // Test whether the polling thread is still running!
 //
 
-	if ( th_info->poll_th != NULL )
-	{
+		if ( th_info->poll_th != NULL )
+		{
+
 //
 // Send command to the polling thread
 //
 
-		cout4 << "Sending cmd to polling thread" << endl;
-		TangoMonitor &mon = th_info->poll_mon;
-		PollThCmd &shared_cmd = th_info->shared_data;
+			cout4 << "Sending cmd to polling thread" << endl;
+			TangoMonitor &mon = th_info->poll_mon;
+			PollThCmd &shared_cmd = th_info->shared_data;
 
-        int th_id = omni_thread::self()->id();
-        if (th_id != poll_th_id)
-		{
-			omni_mutex_lock sync(mon);
-			if (shared_cmd.cmd_pending == true)
+			int th_id = omni_thread::self()->id();
+			if (th_id != poll_th_id)
 			{
-				mon.wait();
-			}
-			shared_cmd.cmd_pending = true;
-			if (tmp_upd == 0)
-				shared_cmd.cmd_code = POLL_REM_EXT_TRIG_OBJ;
-			else
-				shared_cmd.cmd_code = POLL_REM_OBJ;
-			shared_cmd.dev = dev;
-			shared_cmd.name = obj_name;
-			shared_cmd.type = type;
+				omni_mutex_lock sync(mon);
+				if (shared_cmd.cmd_pending == true)
+				{
+					mon.wait();
+				}
+				shared_cmd.cmd_pending = true;
+				if (tmp_upd == 0)
+					shared_cmd.cmd_code = POLL_REM_EXT_TRIG_OBJ;
+				else
+					shared_cmd.cmd_code = POLL_REM_OBJ;
+				shared_cmd.dev = dev;
+				shared_cmd.name = obj_name;
+				shared_cmd.type = type;
 
-			mon.signal();
+				mon.signal();
 
-			cout4 << "Cmd sent to polling thread" << endl;
+				cout4 << "Cmd sent to polling thread" << endl;
 
 //
 // Wait for thread to execute command except if the command is
 // requested by the polling thread itself
 //
 
-			int th_id = omni_thread::self()->id();
-			if (th_id != poll_th_id)
-			{
-				while (shared_cmd.cmd_pending == true)
+				int th_id = omni_thread::self()->id();
+				if (th_id != poll_th_id)
 				{
-					int interupted = mon.wait(DEFAULT_TIMEOUT);
-					if ((shared_cmd.cmd_pending == true) && (interupted == false))
+					while (shared_cmd.cmd_pending == true)
 					{
-						cout4 << "TIME OUT" << endl;
-						Except::throw_exception((const char *)"API_CommandTimedOut",
-					        		(const char *)"Polling thread blocked !!!",
-					        		(const char *)"DServer::rem_obj_polling");
+						int interupted = mon.wait(DEFAULT_TIMEOUT);
+						if ((shared_cmd.cmd_pending == true) && (interupted == false))
+						{
+							cout4 << "TIME OUT" << endl;
+							Except::throw_exception((const char *)"API_CommandTimedOut",
+										(const char *)"Polling thread blocked !!!",
+										(const char *)"DServer::rem_obj_polling");
+						}
 					}
 				}
 			}
-		}
-        else
-        {
-            shared_cmd.cmd_pending = true;
-			if (tmp_upd == 0)
-				shared_cmd.cmd_code = POLL_REM_EXT_TRIG_OBJ;
 			else
-				shared_cmd.cmd_code = POLL_REM_OBJ;
-            shared_cmd.dev = dev;
-            shared_cmd.name = obj_name;
-            shared_cmd.type = type;
-
-            shared_cmd.index = distance(dev->get_poll_obj_list().begin(),ite);
-
-            PollThread *poll_th = th_info->poll_th;
-            poll_th->set_local_cmd(shared_cmd);
-            poll_th->execute_cmd();
-        }
-		cout4 << "Thread cmd normally executed" << endl;
-	}
-	else
-	{
-		cout4 << "Polling thread is no longer running!!!!" << endl;
+			{
+				shared_cmd.cmd_pending = true;
+				if (tmp_upd == 0)
+					shared_cmd.cmd_code = POLL_REM_EXT_TRIG_OBJ;
+				else
+					shared_cmd.cmd_code = POLL_REM_OBJ;
+				shared_cmd.dev = dev;
+				shared_cmd.name = obj_name;
+				shared_cmd.type = type;
+
+				shared_cmd.index = distance(dev->get_poll_obj_list().begin(),ite);
+
+				PollThread *poll_th = th_info->poll_th;
+				poll_th->set_local_cmd(shared_cmd);
+				poll_th->execute_cmd();
+			}
+			cout4 << "Thread cmd normally executed" << endl;
+		}
+		else
+		{
+			cout4 << "Polling thread is no longer running!!!!" << endl;
+		}
 	}
 
 //
@@ -1604,7 +1609,7 @@
 // Kill the thread if needed and join
 //
 
-		if (kill_thread == true)
+		if (kill_thread == true  && tg->is_svr_shutting_down() == false)
 		{
 			TangoMonitor &mon = th_info->poll_mon;
 			PollThCmd &shared_cmd = th_info->shared_data;
diff -Naur '--exclude=.svn' tango_805/lib/cpp/server/eventcmds.cpp tango_805.p1/lib/cpp/server/eventcmds.cpp
--- tango_805/lib/cpp/server/eventcmds.cpp	2012-07-04 08:41:29.448059095 +0200
+++ tango_805.p1/lib/cpp/server/eventcmds.cpp	2012-09-10 14:20:28.963848219 +0200
@@ -345,7 +345,9 @@
 						{
 							if ((attribute.ext->archive_abs_change[0] == INT_MAX) &&
 					      		(attribute.ext->archive_abs_change[1] == INT_MAX) &&
-						   	    (attribute.ext->archive_period        == INT_MAX))
+								(attribute.ext->archive_rel_change[0] == INT_MAX) &&
+								(attribute.ext->archive_rel_change[1] == INT_MAX) &&
+								(attribute.ext->archive_period        == INT_MAX))
 							{
 								TangoSys_OMemStream o;
 								o << "Archive event properties (archive_abs_change or archive_rel_change or archive_period) for attribute ";
diff -Naur '--exclude=.svn' tango_805/lib/cpp/server/pollobj.h tango_805.p1/lib/cpp/server/pollobj.h
--- tango_805/lib/cpp/server/pollobj.h	2012-07-04 08:41:29.436059055 +0200
+++ tango_805.p1/lib/cpp/server/pollobj.h	2012-09-10 14:22:12.612432018 +0200
@@ -131,13 +131,13 @@
 	void get_attr_history_43(long n,Tango::DevAttrHistoryList_3 *ptr,long type);
 
 protected:
-	DeviceImpl		*dev;
-	PollObjType		type;
-	string 			name;
+	DeviceImpl			*dev;
+	PollObjType			type;
+	string 				name;
 	struct timeval		upd;
 	struct timeval		needed_time;
-	double			max_delta_t;
-	PollRing		ring;
+	double				max_delta_t;
+	PollRing			ring;
 };
 
 inline bool operator<(const PollObj &,const PollObj &)
