You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Oleg Evseev <ev...@gmail.com> on 2020/06/30 12:45:03 UTC

How to debug DEBUGASSERT in shed?

Hi all,

I wonder how can I debug
DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
semaphore/sem_holder.c that happens after some time reading a lot of
messages from can bus in can_reciever task?

Task  looks like this (CAN dev is opened as shared file with
file_open(&CANmodule->file, "/dev/can0", O_RDWR)):

pollfd fds[1];
fds[0].fd = -1;
fds[0].ptr = CANmodule->file ;
fds[0].events = POLLIN | POLLFILE;

while (!_thread_should_exit) {
    int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);

    if (fds[0].revents & POLLIN) {
        /* Read the RX message */
        CANreceive();
    }
}

void CANreceive(CANmodule_t *CANmodule){
struct can_msg_s msg = {};
ssize_t nbytes;

    nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct can_msg_s) );
    ...
}

Thanks in advance for any help.

-- 
With regards,
Oleg.

Re: How to debug DEBUGASSERT in shed?

Posted by Oleg Evseev <ev...@gmail.com>.
 Found out that DEBUGASSERT(pholder != NULL) was not caused by can driver
itself, but just related to a task, where I'm polling can, that's why I
misled, sorry.
Alan and Gregory, thanks for feedbacks!

As for issue 1354 <https://github.com/apache/incubator-nuttx/issues/1354>,
made the PR 1370 <https://github.com/apache/incubator-nuttx/pull/1370>.

пт, 3 июл. 2020 г. в 16:26, Oleg Evseev <ev...@gmail.com>:

> Hi, Alan.
>
> Thanks for the feedback.
>
> Found out that I'm still get DEBUGASSERT(pholder != NULL) in function
> nxsem_allocholder in file semaphore/sem_holder.c after
> DEBUGASSERT(sem->semcount<SEM_VALUE_MAX) fix, so it seems that they are not
> related.
> I'm trying to investigate this.
>
> пт, 3 июл. 2020 г. в 15:47, Alan Carvalho de Assis <ac...@gmail.com>:
>
>> Hi Oleg,
>>
>> I just responded your issue.
>>
>> I hope to have shed some light there.
>>
>> BR,
>>
>> Alan
>>
>> On 7/3/20, Oleg Evseev <ev...@gmail.com> wrote:
>> > Regarding to can driver, from some moment I started getting
>> > DEBUGASSERT(sem->semcount<SEM_VALUE_MAX)
>> > in sem_post.c. Found the bug
>> > https://github.com/apache/incubator-nuttx/issues/1354
>> >
>> > I don't know, was DEBUGASSERT(pholder != NULL) a different appearance of
>> > the same bug or it is something else.
>> >
>> > --
>> > With regards,
>> > Oleg.
>> >
>> >
>> > вт, 30 июн. 2020 г. в 20:16, Oleg Evseev <ev...@gmail.com>:
>> >
>> >> Find out that this happens while in poll.
>> >>
>> >> вт, 30 июн. 2020 г. в 15:45, Oleg Evseev <ev...@gmail.com>:
>> >>
>> >>> Hi all,
>> >>>
>> >>> I wonder how can I debug
>> >>> DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
>> >>> semaphore/sem_holder.c that happens after some time reading a lot of
>> >>> messages from can bus in can_reciever task?
>> >>>
>> >>> Task  looks like this (CAN dev is opened as shared file with
>> >>> file_open(&CANmodule->file, "/dev/can0", O_RDWR)):
>> >>>
>> >>> pollfd fds[1];
>> >>> fds[0].fd = -1;
>> >>> fds[0].ptr = CANmodule->file ;
>> >>> fds[0].events = POLLIN | POLLFILE;
>> >>>
>> >>> while (!_thread_should_exit) {
>> >>>     int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);
>> >>>
>> >>>     if (fds[0].revents & POLLIN) {
>> >>>         /* Read the RX message */
>> >>>         CANreceive();
>> >>>     }
>> >>> }
>> >>>
>> >>> void CANreceive(CANmodule_t *CANmodule){
>> >>> struct can_msg_s msg = {};
>> >>> ssize_t nbytes;
>> >>>
>> >>>     nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct
>> can_msg_s)
>> >>> );
>> >>>     ...
>> >>> }
>> >>>
>> >>> Thanks in advance for any help.
>> >>>
>> >>> --
>> >>> With regards,
>> >>> Oleg.
>> >>>
>> >>
>> >
>>
>

Re: How to debug DEBUGASSERT in shed?

Posted by Oleg Evseev <ev...@gmail.com>.
Hi, Alan.

Thanks for the feedback.

Found out that I'm still get DEBUGASSERT(pholder != NULL) in function
nxsem_allocholder in file semaphore/sem_holder.c after
DEBUGASSERT(sem->semcount<SEM_VALUE_MAX) fix, so it seems that they are not
related.
I'm trying to investigate this.

пт, 3 июл. 2020 г. в 15:47, Alan Carvalho de Assis <ac...@gmail.com>:

> Hi Oleg,
>
> I just responded your issue.
>
> I hope to have shed some light there.
>
> BR,
>
> Alan
>
> On 7/3/20, Oleg Evseev <ev...@gmail.com> wrote:
> > Regarding to can driver, from some moment I started getting
> > DEBUGASSERT(sem->semcount<SEM_VALUE_MAX)
> > in sem_post.c. Found the bug
> > https://github.com/apache/incubator-nuttx/issues/1354
> >
> > I don't know, was DEBUGASSERT(pholder != NULL) a different appearance of
> > the same bug or it is something else.
> >
> > --
> > With regards,
> > Oleg.
> >
> >
> > вт, 30 июн. 2020 г. в 20:16, Oleg Evseev <ev...@gmail.com>:
> >
> >> Find out that this happens while in poll.
> >>
> >> вт, 30 июн. 2020 г. в 15:45, Oleg Evseev <ev...@gmail.com>:
> >>
> >>> Hi all,
> >>>
> >>> I wonder how can I debug
> >>> DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
> >>> semaphore/sem_holder.c that happens after some time reading a lot of
> >>> messages from can bus in can_reciever task?
> >>>
> >>> Task  looks like this (CAN dev is opened as shared file with
> >>> file_open(&CANmodule->file, "/dev/can0", O_RDWR)):
> >>>
> >>> pollfd fds[1];
> >>> fds[0].fd = -1;
> >>> fds[0].ptr = CANmodule->file ;
> >>> fds[0].events = POLLIN | POLLFILE;
> >>>
> >>> while (!_thread_should_exit) {
> >>>     int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);
> >>>
> >>>     if (fds[0].revents & POLLIN) {
> >>>         /* Read the RX message */
> >>>         CANreceive();
> >>>     }
> >>> }
> >>>
> >>> void CANreceive(CANmodule_t *CANmodule){
> >>> struct can_msg_s msg = {};
> >>> ssize_t nbytes;
> >>>
> >>>     nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct
> can_msg_s)
> >>> );
> >>>     ...
> >>> }
> >>>
> >>> Thanks in advance for any help.
> >>>
> >>> --
> >>> With regards,
> >>> Oleg.
> >>>
> >>
> >
>

Re: How to debug DEBUGASSERT in shed?

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Olev,

I just responded your issue.

I hope to have shed some light there.

BR,

Alan

On 7/3/20, Oleg Evseev <ev...@gmail.com> wrote:
> Regarding to can driver, from some moment I started getting
> DEBUGASSERT(sem->semcount<SEM_VALUE_MAX)
> in sem_post.c. Found the bug
> https://github.com/apache/incubator-nuttx/issues/1354
>
> I don't know, was DEBUGASSERT(pholder != NULL) a different appearance of
> the same bug or it is something else.
>
> --
> With regards,
> Oleg.
>
>
> вт, 30 июн. 2020 г. в 20:16, Oleg Evseev <ev...@gmail.com>:
>
>> Find out that this happens while in poll.
>>
>> вт, 30 июн. 2020 г. в 15:45, Oleg Evseev <ev...@gmail.com>:
>>
>>> Hi all,
>>>
>>> I wonder how can I debug
>>> DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
>>> semaphore/sem_holder.c that happens after some time reading a lot of
>>> messages from can bus in can_reciever task?
>>>
>>> Task  looks like this (CAN dev is opened as shared file with
>>> file_open(&CANmodule->file, "/dev/can0", O_RDWR)):
>>>
>>> pollfd fds[1];
>>> fds[0].fd = -1;
>>> fds[0].ptr = CANmodule->file ;
>>> fds[0].events = POLLIN | POLLFILE;
>>>
>>> while (!_thread_should_exit) {
>>>     int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);
>>>
>>>     if (fds[0].revents & POLLIN) {
>>>         /* Read the RX message */
>>>         CANreceive();
>>>     }
>>> }
>>>
>>> void CANreceive(CANmodule_t *CANmodule){
>>> struct can_msg_s msg = {};
>>> ssize_t nbytes;
>>>
>>>     nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct can_msg_s)
>>> );
>>>     ...
>>> }
>>>
>>> Thanks in advance for any help.
>>>
>>> --
>>> With regards,
>>> Oleg.
>>>
>>
>

Re: How to debug DEBUGASSERT in shed?

Posted by Oleg Evseev <ev...@gmail.com>.
Regarding to can driver, from some moment I started getting
DEBUGASSERT(sem->semcount<SEM_VALUE_MAX)
in sem_post.c. Found the bug
https://github.com/apache/incubator-nuttx/issues/1354

I don't know, was DEBUGASSERT(pholder != NULL) a different appearance of
the same bug or it is something else.

-- 
With regards,
Oleg.


вт, 30 июн. 2020 г. в 20:16, Oleg Evseev <ev...@gmail.com>:

> Find out that this happens while in poll.
>
> вт, 30 июн. 2020 г. в 15:45, Oleg Evseev <ev...@gmail.com>:
>
>> Hi all,
>>
>> I wonder how can I debug
>> DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
>> semaphore/sem_holder.c that happens after some time reading a lot of
>> messages from can bus in can_reciever task?
>>
>> Task  looks like this (CAN dev is opened as shared file with
>> file_open(&CANmodule->file, "/dev/can0", O_RDWR)):
>>
>> pollfd fds[1];
>> fds[0].fd = -1;
>> fds[0].ptr = CANmodule->file ;
>> fds[0].events = POLLIN | POLLFILE;
>>
>> while (!_thread_should_exit) {
>>     int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);
>>
>>     if (fds[0].revents & POLLIN) {
>>         /* Read the RX message */
>>         CANreceive();
>>     }
>> }
>>
>> void CANreceive(CANmodule_t *CANmodule){
>> struct can_msg_s msg = {};
>> ssize_t nbytes;
>>
>>     nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct can_msg_s)
>> );
>>     ...
>> }
>>
>> Thanks in advance for any help.
>>
>> --
>> With regards,
>> Oleg.
>>
>

Re: How to debug DEBUGASSERT in shed?

Posted by Oleg Evseev <ev...@gmail.com>.
Find out that this happens while in poll.

вт, 30 июн. 2020 г. в 15:45, Oleg Evseev <ev...@gmail.com>:

> Hi all,
>
> I wonder how can I debug
> DEBUGASSERT(pholder != NULL) in function nxsem_allocholder in file
> semaphore/sem_holder.c that happens after some time reading a lot of
> messages from can bus in can_reciever task?
>
> Task  looks like this (CAN dev is opened as shared file with
> file_open(&CANmodule->file, "/dev/can0", O_RDWR)):
>
> pollfd fds[1];
> fds[0].fd = -1;
> fds[0].ptr = CANmodule->file ;
> fds[0].events = POLLIN | POLLFILE;
>
> while (!_thread_should_exit) {
>     int ret = poll(fds, sizeof(fds) / sizeof(fds[0]), 1000);
>
>     if (fds[0].revents & POLLIN) {
>         /* Read the RX message */
>         CANreceive();
>     }
> }
>
> void CANreceive(CANmodule_t *CANmodule){
> struct can_msg_s msg = {};
> ssize_t nbytes;
>
>     nbytes = file_read(&CANmodule->file, &msg,  sizeof(struct can_msg_s) );
>     ...
> }
>
> Thanks in advance for any help.
>
> --
> With regards,
> Oleg.
>


-- 
С Уважением,
Евсеев Олег.