{"action":"created","issue":{"url":"https://api.github.com/repos/robotology/icub-main/issues/127","labels_url":"https://api.github.com/repos/robotology/icub-main/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/robotology/icub-main/issues/127/comments","events_url":"https://api.github.com/repos/robotology/icub-main/issues/127/events","html_url":"https://github.com/robotology/icub-main/issues/127","id":63698040,"number":127,"title":"RobotInterface should call shutdown action if something goes wrong in startup actions","user":{"login":"barbalberto","id":4061020,"avatar_url":"https://avatars.githubusercontent.com/u/4061020?v=3","gravatar_id":"","url":"https://api.github.com/users/barbalberto","html_url":"https://github.com/barbalberto","followers_url":"https://api.github.com/users/barbalberto/followers","following_url":"https://api.github.com/users/barbalberto/following{/other_user}","gists_url":"https://api.github.com/users/barbalberto/gists{/gist_id}","starred_url":"https://api.github.com/users/barbalberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbalberto/subscriptions","organizations_url":"https://api.github.com/users/barbalberto/orgs","repos_url":"https://api.github.com/users/barbalberto/repos","events_url":"https://api.github.com/users/barbalberto/events{/privacy}","received_events_url":"https://api.github.com/users/barbalberto/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"drdanz","id":1100056,"avatar_url":"https://avatars.githubusercontent.com/u/1100056?v=3","gravatar_id":"","url":"https://api.github.com/users/drdanz","html_url":"https://github.com/drdanz","followers_url":"https://api.github.com/users/drdanz/followers","following_url":"https://api.github.com/users/drdanz/following{/other_user}","gists_url":"https://api.github.com/users/drdanz/gists{/gist_id}","starred_url":"https://api.github.com/users/drdanz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drdanz/subscriptions","organizations_url":"https://api.github.com/users/drdanz/orgs","repos_url":"https://api.github.com/users/drdanz/repos","events_url":"https://api.github.com/users/drdanz/events{/privacy}","received_events_url":"https://api.github.com/users/drdanz/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-03-23T11:12:49Z","updated_at":"2015-03-24T14:42:57Z","closed_at":"2015-03-24T14:42:57Z","body":"The execution is the following:\r\n\r\nAll devices opens correctly, then wrappers does their attach action correctly, then the cartesian server does its attach action and fails. (at the end, how to reproduce it)\r\n\r\nThe robotInterface correctly propagates the error and starts closing procedure.\r\nIt correctly calls the close function of each device, but since the order of the close is not garanteed (which makes sense), it happens that the motorcontroldevice close is been called before the controlBoardWrapper close.\r\n\r\nThis causes the wrapper to keep working on a motor control device which has already been closed and it crashes.\r\n\r\nFIX: I found calling the shutdown action if startup actions fails, fixes this particular error.\r\n\r\n   // Enter startup phase\r\n    if (!mPriv->robot.enterPhase(RobotInterface::ActionPhaseStartup)) {\r\n        yError() << \"Error in\" << ActionPhaseToString(RobotInterface::ActionPhaseStartup) << \"phase... see previous messages for more info\";\r\n\r\n        if (!mPriv->robot.enterPhase(RobotInterface::ActionPhaseShutdown)) {\r\n            yError() << \"Error in\" << ActionPhaseToString(RobotInterface::ActionPhaseInterrupt1) << \"phase... see previous messages for more info\";\r\n        }\r\n        return false;\r\n    }\r\n\r\nI don't know if only shutdown action has to be called here or also  interrupt ones, can @drdanz have a check please?\r\n\r\n\r\n---------\r\n\r\nTo reproduce it:\r\n- set a fake ip address on your pc with\r\nsudo ifconfig eth0:104 10.0.1.104/24\r\n- set ethTransceiver to skip check of real EMS is present uncommenting \r\n#define ETHRES_DEBUG_DONTREADBACK in ethResources.cpp\r\nstart the robotInterface using iCubGenova04 with cartesian controller in and head and skins off\r\n"},"comment":{"url":"https://api.github.com/repos/robotology/icub-main/issues/comments/85534569","html_url":"https://github.com/robotology/icub-main/issues/127#issuecomment-85534569","issue_url":"https://api.github.com/repos/robotology/icub-main/issues/127","id":85534569,"user":{"login":"barbalberto","id":4061020,"avatar_url":"https://avatars.githubusercontent.com/u/4061020?v=3","gravatar_id":"","url":"https://api.github.com/users/barbalberto","html_url":"https://github.com/barbalberto","followers_url":"https://api.github.com/users/barbalberto/followers","following_url":"https://api.github.com/users/barbalberto/following{/other_user}","gists_url":"https://api.github.com/users/barbalberto/gists{/gist_id}","starred_url":"https://api.github.com/users/barbalberto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbalberto/subscriptions","organizations_url":"https://api.github.com/users/barbalberto/orgs","repos_url":"https://api.github.com/users/barbalberto/repos","events_url":"https://api.github.com/users/barbalberto/events{/privacy}","received_events_url":"https://api.github.com/users/barbalberto/received_events","type":"User","site_admin":false},"created_at":"2015-03-24T14:42:56Z","updated_at":"2015-03-24T14:42:56Z","body":"fixed with 4d64c0b57f80d512da31799c3946e631b46aec93\r\n\r\nNow it a startup action fails, the interruptModule is called, therefore doing the very same closing procedure as a 'normal' close.\r\nThis means all the interrupt and shutdown action are performed assuring a correct de-initialization of work done by start-up actions"}}