There is no device with ID

123Lookatme
Posts: 5
Joined: Tue Dec 23, 2014 3:31 pm

There is no device with ID

Postby 123Lookatme » Wed Jul 29, 2015 2:23 am

Hi. I have a problem with some type of devices. Especialy with android. All the api works fine, but in some cases it throws exception :
"There is no device with ID [generic_android_ver5_1] in the loaded WURFL Data" or slt.
Specifically this one was throwed with Nexus 5. UA -
"Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Mobile Safari/537.36"
.
For the first time i thought the problem was with persistance not loaded, because of wurfl online demo works fine and shows correct device:
http://tools.scientiamobile.com/?user-a ... i%2F537.36
But then i went to dev section and download the last version :
http://sourceforge.net/projects/wurfl/f ... PHP/1.6.1/
I just unpack it and store to my local server. and what my surprise was when I found the same bug with demo page from the last version:

Code: Select all

Fatal error: Uncaught exception 'Exception' with message 'There is no device with ID [generic_android_ver5_1] in the loaded WURFL Data' in /var/www/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php:104 Stack trace:
#0 /var/www/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php(207): WURFL_CustomDeviceRepository->getDevice('generic_android...')
#1 /var/www/wurfl-php-1.6.0.1/WURFL/WURFLService.php(146): WURFL_CustomDeviceRepository->getDeviceHierarchy('generic_android...')
#2 /var/www/wurfl-php-1.6.0.1/WURFL/WURFLService.php(62): WURFL_WURFLService->getWrappedDevice('generic_android...', Object(WURFL_Request_GenericRequest))
#3 /var/www/wurfl-php-1.6.0.1/WURFL/WURFLManager.php(90): WURFL_WURFLService->getDeviceForRequest(Object(WURFL_Request_GenericRequest))
#4 /var/www/wurfl-php-1.6.0.1/WURFL/WURFLManager.php(122): WURFL_WURFLManager->getDeviceForRequest(Object(WURFL_Request_GenericRequest))
#5 /var/www/wurfl-php-1.6.0.1/examples/demo/index.php(14): WURFL_WURFLManager->getDeviceForUserAgent('Mozilla/5.0 (Li...')
#6 {main} in /var/www/wurfl-php-1.6.0.1/WURFL/CustomDeviceRepository.php on line 104
Can you please explain me what exactly should i do to avoid this problem

Elliotfehr

Re: There is no device with ID

Postby Elliotfehr » Wed Jul 29, 2015 6:13 pm

Hello,

I have just tested against the same release and am unable to replicate this issue on my machine. Your initial assumption does sound correct and I would recommend to delete the persistence directory and attempt to reload the wurfl.xml as well as ensure that your webserver has read/write access to this directory.

Thank you,

Elliot

123Lookatme
Posts: 5
Joined: Tue Dec 23, 2014 3:31 pm

Re: There is no device with ID

Postby 123Lookatme » Thu Jul 30, 2015 1:49 am

Thank you for your reply. Removing persistance folder and wurfl.xml from /tmp actualy helps with this issue. So as i assume, for my standalone app, that starts just once - every time i load new wurlf.zip, rebuilding wurfl manager(remove();create()) is not enough and i actualy should remove this wurfl.xml from /tmp. is it correct ?

Elliotfehr

Re: There is no device with ID

Postby Elliotfehr » Thu Jul 30, 2015 9:53 am

Are you able to share a code sample of your WURFL Manager object for me confirm? If you have `allowReload()` set to true, the WURFL API will automatically rebuild the persistence files if the wurfl.xml is updated and thus not requiring you to remove the persistence directory manually each time.

Thank you,

Elliot

123Lookatme
Posts: 5
Joined: Tue Dec 23, 2014 3:31 pm

Re: There is no device with ID

Postby 123Lookatme » Fri Jul 31, 2015 9:45 am

I have "socket chat app" that using wurfl. So wurfl-manager created just once when this app initialize and leave untill it be restarting. So i need to send some signal to wurfl-manager so it could rebuild himself after new wurfl.zip file is uploaded. In this case i'm using 2 methods: remove() to kill it and create() to rebuild with new wurfl.zip. So as i assume the problem is data not alawys loading correct to storage after rebuilt.

Elliotfehr

Re: There is no device with ID

Postby Elliotfehr » Fri Jul 31, 2015 4:55 pm

From what I can tell, it does not appear to have reloaded properly. If you are able to provide me a code sample of your configuration I can let you know if I see any errors.

Thank you,

Elliot

123Lookatme
Posts: 5
Joined: Tue Dec 23, 2014 3:31 pm

Re: There is no device with ID

Postby 123Lookatme » Mon Aug 03, 2015 7:58 am

Sure, here it is:

Code: Select all

 public function init() {
        $wurflDir = \Yii::getAlias('@vendor/wurfl/wurfl-api/WURFL');
        require_once $wurflDir . '/Application.php';

        $this->_config = new \WURFL_Configuration_InMemoryConfig();
        $this->_config->wurflFile(\Yii::getAlias($this->wurflxml));
        $this->_config->matchMode($this->matchMode);
        $this->_config->allowReload(true);
        $this->_config->capabilityFilter(array(
            "brand_name",
            "marketing_name",
            "model_name",
            'model_extra_info',
            "device_os",
            "device_os_version",
            "is_tablet",
            'is_smarttv',
            "is_wireless_device",
            "mobile_browser",
            "mobile_browser_version",
            "pointing_method",
            "preferred_markup",
            "resolution_height",
            "resolution_width",
            "ux_full_desktop",
            "xhtml_support_level",
            'can_assign_phone_number',
            'x_related_ids',
        ));
        $this->_config->cache('null', []);
        $this->_config->persistence('file', ['dir' => \Yii::getAlias('@runtime') . '/wurfl_storage']);
        $this->wurflManagerFactory = new \WURFL_WURFLManagerFactory($this->_config);
        $this->_wurflManager = $this->wurflManagerFactory->create();
    }
So after new file uploaded it sets to $this->wurflxml. And Then exetutes:

Code: Select all

 public function closeWurflxml() {
        $this->_config->wurflFile(\Yii::getAlias($this->wurflxml));
        $this->wurflManagerFactory->remove();
        $this->_wurflManager = $this->wurflManagerFactory->create();
        return true;
    }
Thank you!

Elliotfehr

Re: There is no device with ID

Postby Elliotfehr » Mon Aug 03, 2015 10:31 am

I see that you have set `$this->_config->allowReload(true)`, which will automatically reload the `wurfl.xml` if the timestamp on the current `wurfl.xml` is newer than the currently loaded one.


Thank you,

Elliot


Who is online

Users browsing this forum: No registered users and 3 guests