Resource busy - raspbian buster, weewx 4 and WMR200

176 views
Skip to first unread message

Clo Di

unread,
May 7, 2020, 7:30:05 AM5/7/20
to weewx-user
Hello! I have been using Weewx for many years with raspbian on a  raspberry with a WMR200 station.
This week, I installed the new system (buster - 10.3) and the new version of weewx.
I also used a new base SQLite.
Weewx launch correctly for a  few hours. But there "regurlarly" an error. The unique solution is to stop and start weewx.

Someone have an idea what is the source of the problem?

$ sudo systemctl status weewx
weewx.service - LSB: weewx weather system
   Loaded: loaded (/etc/init.d/weewx; generated)
   Active: active (running) since Tue 2020-05-05 23:10:17 CEST; 1 day 13h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5624 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
   Memory: 29.5M
   CGroup: /system.slice/weewx.service
           └─5640 python3 /usr/share/weewx/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****      self.console = loader_function(config_dict, self)
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/wmr200.py", line 58, in loader
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****      return WMR200(**config_dict[DRIVER_NAME])
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/wmr200.py", line 1466, in __init__
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****      self.usb_device.open_device()
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****    File "/usr/share/weewx/weewx/drivers/wmr200.py", line 196, in open_device
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****      raise weewx.WakeupError(exception)
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL weewx.engine:     ****  weewx.WakeupError: [Errno 16] Resource busy
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL __main__: Unable to load driver: [Errno 16] Resource busy
mai 07 06:41:05 domo python3[5640]: weewx[5640] CRITICAL __main__:     ****  Exiting...

journal_weewx.log

Tom Keffer

unread,
May 7, 2020, 10:29:45 AM5/7/20
to weewx-user
I am guessing the problem is that the WMR200 driver is not always releasing the USB interface, despite saying it has.

One thing you can try is run weewxd with the loop_on_init flag. This will cause it to keep trying. See the section General in the User's Guide.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/b6aa4404-a1ef-476f-bbb0-e2a87fbfaff4%40googlegroups.com.

CloDi

unread,
May 8, 2020, 6:45:17 AM5/8/20
to weewx...@googlegroups.com

Hello.

The problem started again. The USB port is not seen as free despite the configuration change. Attached is the journal.

I change the configuration to start the debug mode...

journal_weewx.log

CloDi

unread,
May 8, 2020, 9:49:18 AM5/8/20
to weewx...@googlegroups.com

Hi.

Same error. I have activated the debug and joined the log.

I don't know python to help to debug. But I can test any script...

Thanks!


Le 07/05/2020 à 16:29, Tom Keffer a écrit :
journal_weewx.log

Tom Keffer

unread,
May 8, 2020, 10:28:21 AM5/8/20
to weewx-user
I've asked the author of the driver for help.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Chris Manton

unread,
May 29, 2020, 1:36:54 AM5/29/20
to weewx-user
It looks like the initial error was a read failure from the device.
The second error is despite retries the resource is not reset to re-open and re-claim.

Since the system worked for a long time without this failure, I would think something about the new installation.

If the initial error 'froze' the usb bus, no amount of software tries will  jiggle it lose.

mai 08 13:08:10 domo python3[322]: weewx[322] ERROR weewx.drivers.wmr200: USB read_device overflow error
mai 08 13:08:10 domo python3[322]: weewx[322] ERROR weewx.drivers.wmr200: USB device read error
mai 08 13:08:11 domo python3[322]: weewx[322] ERROR weewx.drivers.wmr200: USB polling thread unexpectedly 

I think we'd need to know the state of the wmr200 and/or usb bus at the time of failure, or understand exactly what kind of read_device overflow error occurred.

On Friday, May 8, 2020 at 7:28:21 AM UTC-7, Tom Keffer wrote:
I've asked the author of the driver for help.

On Fri, May 8, 2020 at 6:49 AM CloDi <clodi...@gmail.com> wrote:

Hi.

Same error. I have activated the debug and joined the log.

I don't know python to help to debug. But I can test any script...

Thanks!


Le 07/05/2020 à 16:29, Tom Keffer a écrit :
I am guessing the problem is that the WMR200 driver is not always releasing the USB interface, despite saying it has.

One thing you can try is run weewxd with the loop_on_init flag. This will cause it to keep trying. See the section General in the User's Guide.


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx...@googlegroups.com.

Joseph TOMEH

unread,
Jun 10, 2020, 8:24:04 AM6/10/20
to weewx-user
Hello all, 

Almost same error message too.
I used with Weewx 3.9.1(Python2) for a long time and it worked well with no issues.
I have just updated to version Weewx 4.1.1 (python3), and this error occurs several time a day.
This is the only change I have done

:(

Regards


2854 Jun 10 11:02:01 raspberrypi weewx[21331] INFO weewx.drivers.wmr200: sensor map is {'altimeter': 'altimeter', 'pressure': 'pressure', 'windSpeed': 'wind_speed', 'windDir': 'wind_dir', 'windGust': 'wind_gust$2855 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.drivers.wmr200: open_device() Unable to claim USB interface. Reason: [Errno 16] Resource busy
2856 Jun 10 11:02:01 raspberrypi weewx[21331] ERROR weewx.engine: Import of driver failed: [Errno 16] Resource busy (<class '   '>)
2857 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****  Traceback (most recent call last):
2858 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/home/weewx/bin/weewx/drivers/wmr200.py", line 193, in open_device
2859 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      self.handle.claimInterface(self.interface)
2860 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/legacy.py", line 230, in claimInterface
2861 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      util.claim_interface(self.dev, interface)
2862 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/util.py", line 205, in claim_interface
2863 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      device._ctx.managed_claim_interface(device, interface)
2864 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/core.py", line 102, in wrapper
2865 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      return f(self, *args, **kwargs)
2866 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/core.py", line 167, in managed_claim_interface
2867 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      self.backend.claim_interface(self.handle, i)
2868 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/backend/libusb1.py", line 811, in claim_interface
2869 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      _check(self.lib.libusb_claim_interface(dev_handle.handle, intf))
2870 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****    File "/usr/local/lib/python3.7/dist-packages/usb/backend/libusb1.py", line 595, in _check
2871 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****      raise USBError(_strerror(ret), ret, _libusb_errno[ret])
2872 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****  usb.core.USBError: [Errno 16] Resource busy
2873 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****
2874 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****  During handling of the above exception, another exception occurred:
2875 Jun 10 11:02:01 raspberrypi weewx[21331] CRITICAL weewx.engine:     ****


AsgeirK

unread,
Jun 24, 2020, 11:16:07 AM6/24/20
to weewx-user
I'm having similar issues after upgrade to 4.1.1

Jun 24 13:22:17 PI-W4 weewx[546] ERROR weewx.drivers.wmr200: USB read_device overflow error
Jun 24 13:22:17 PI-W4 weewx[546] ERROR weewx.drivers.wmr200: USB device read error
Jun 24 13:22:17 PI-W4 weewx[546] DEBUG weewx.manager: Daily summary version is 1.0
Jun 24 13:22:18 PI-W4 weewx[546] INFO weewx.restx: Wunderground-PWS: Published record 2020-06-24 13:22:00 CEST (1592997720)
Jun 24 13:22:18 PI-W4 weewx[546] ERROR weewx.drivers.wmr200: USB polling thread unexpectedly terminated
Jun 24 13:22:18 PI-W4 weewx[546] INFO weewx.engine: Main loop exiting. Shutting engine down.
Jun 24 13:22:18 PI-W4 weewx[546] INFO weewx.engine: Shutting down StdReport thread
Jun 24 13:22:31 PI-W4 weewx[546] INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 13.79 seconds
Jun 24 13:22:31 PI-W4 weewx[546] DEBUG weewx.manager: Daily summary version is 1.0
Jun 24 13:22:31 PI-W4 systemd[1]: Started Session c1681 of user pi.
Jun 24 13:22:37 PI-W4 weewx[546] INFO weewx.imagegenerator: Generated 15 images for report SeasonsReport in 6.01 seconds
Jun 24 13:22:37 PI-W4 weewx[546] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx
Jun 24 13:22:37 PI-W4 weewx[546] DEBUG weewx.reportengine: Running report 'SmartphoneReport'
Jun 24 13:22:37 PI-W4 weewx[546] DEBUG weewx.reportengine: Found configuration file /etc/weewx/skins/Smartphone/skin.conf for report 'SmartphoneReport'
Jun 24 13:22:37 PI-W4 weewx[546] DEBUG weewx.cheetahgenerator: Using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras']
Jun 24 13:22:37 PI-W4 weewx[546] DEBUG weewx.manager: Daily summary version is 1.0
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.cheetahgenerator: Generated 6 files for report SmartphoneReport in 0.51 seconds
Jun 24 13:22:38 PI-W4 weewx[546] DEBUG weewx.manager: Daily summary version is 1.0
Jun 24 13:22:38 PI-W4 weewx[546] ERROR weewx.engine: Unable to shut down StdReport thread
Jun 24 13:22:38 PI-W4 weewx[546] DEBUG weewx.restx: Shut down Wunderground-PWS thread.
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: USB polling thread expired
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog received shutdown
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog thread exiting
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog thread expired
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Received packet count live:15445 archive:940 control:1782
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Received bytes:1993192 sent bytes:47720
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Packet archive queue len:21 live queue len:0
Jun 24 13:22:38 PI-W4 weewx[546] WARNING weewx.drivers.wmr200: Exiting with packets still in archive queue cnt:21
Jun 24 13:22:38 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Driver gracefully exiting
Jun 24 13:22:38 PI-W4 weewx[546] CRITICAL __main__: Caught WeeWxIOError: USB polling thread unexpectedly terminated
Jun 24 13:22:38 PI-W4 weewx[546] CRITICAL __main__:     ****  Waiting 60 seconds then retrying...
Jun 24 13:22:40 PI-W4 weewx[546] INFO weewx.imagegenerator: Generated 6 images for report SmartphoneReport in 2.05 seconds
Jun 24 13:22:40 PI-W4 weewx[546] INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx/smartphone
.
.
.
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Using pc time adjusting archive record time by 3765 sec 2020-06-24 12:20:00 CEST (1592994000) => 2020-06-24 13:22:45 CEST (1592997765)
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.engine: Main loop exiting. Shutting engine down.
Jun 24 13:23:46 PI-W4 weewx[546] DEBUG weewx.restx: Shut down Wunderground-PWS thread.
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: USB polling device thread exiting
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: USB polling thread expired
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog received shutdown
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog thread exiting
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Watchdog thread expired
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Received packet count live:15446 archive:941 control:1784
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Received bytes:664 sent bytes:48
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Packet archive queue len:0 live queue len:1
Jun 24 13:23:46 PI-W4 weewx[546] WARNING weewx.drivers.wmr200: Exiting with packets still in live queue cnt:1
Jun 24 13:23:46 PI-W4 weewx[546] INFO weewx.drivers.wmr200: Driver gracefully exiting
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__: Caught unrecoverable exception:
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****  global name 'loginf' is not defined
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****  Traceback (most recent call last):
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 154, in main
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      engine.run()
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 158, in run
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.STARTUP))
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      callback(event)
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 530, in startup
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      self._catchup(self.engine.console.genStartupRecords)
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 638, in _catchup
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      for record in generator(lastgood_ts):
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/drivers/wmr200.py", line 1920, in genStartupRecords
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****      loginf('genStartup() Discarding received archive record'
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****  NameError: global name 'loginf' is not defined
Jun 24 13:23:46 PI-W4 weewx[546] CRITICAL __main__:     ****  Exiting.
Jun 24 13:24:31 PI-W4 systemd[1]: Started Session c1683 of user pi.

AsgeirK

unread,
Jul 6, 2020, 4:50:38 AM7/6/20
to weewx-user
Any updates on this problem?

Asgeir

Tom Keffer

unread,
Jul 6, 2020, 11:05:38 AM7/6/20
to weewx-user
Issue #578 has been tracking this problem. While there is no resolution for the "resource busy" problem, the latest driver does have a fix for the "global name 'loginf' is not defined' problem. 

Replace your copy of wmr200.py with this one.

On Mon, Jul 6, 2020 at 1:50 AM AsgeirK <asgeir...@gmail.com> wrote:
Any updates on this problem?

Asgeir

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/110970ff-11d2-4f54-aea4-71d938f049bfo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages