Skip to content

xhc-whb04b-6 code is sprinkled with assert() and fails occasionally due to that. Please remove assert() with NDEBUG because the code does the right thing without assert() #2237

@MetalMusings

Description

@MetalMusings

Here are the steps I follow to reproduce the issue:

  1. Download and install linuxcnc on debian as a package in the standard way
  2. Start linuxcnc and use the xhc-whb04b-6. After a random time, hours perhaps, it stops responding
  3. I don't have the error message here but I have searched and found that this is the line that triggers the xhc-whb04b-6 module to exit:
    assert(0 == r);
    line 460 in https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/user_comps/xhc-whb04b-6/usb.cc
    in the function
    bool Usb::setupAsyncTransfer()

This is what I expected to happen:

If it was unable to setup async usb transfer, it should do some retrying or so.

This is what happened instead:

The hal module stops. It isn't possible to unload or in any way repair this (afaik).

It worked properly before this:

(If the behavior changed after making a particular change in hardware or
software, describe the change you think is responsible. E.g., "after upgrading
from LinuxCNC 2.7.3 to 2.7.4")
I got a new xhc whb04b-4 the other day, so I have always had this problem with the new pendant.

Information about my hardware and software:

I am running 2.8 from apt archive.
I have also downloaded the developer source code and searched files and recompiled.
The issue is in both those versions.
The solution is simple. Disarm the assert() function with the NDEBUG directive.
Because when this is done, the code does the right thing. It tries to reconnect and re-establish
functionality.
I have gotten an error in setupasynctransfer, the code handles this fine, and re-established functionality.
I am now running a version with NDEBUG and, yes this is how it should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions