All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Steven Kauffmann <steven.kauffmann@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] System freezes when CAN buffer overflows
Date: Wed, 05 May 2010 21:27:17 +0200	[thread overview]
Message-ID: <4BE1C695.10803@domain.hid> (raw)
In-Reply-To: <l2tff1d78711005030332i4120fbc5w46c47785200e67ce@domain.hid>

On 05/03/2010 12:32 PM, Steven Kauffmann wrote:
> Hi all,
> 
> When I close my application a cleanup function is called. In this
> function I first close the CAN listener thread that handles incoming
> CAN messages. After that some other cleanup code is executed and at
> the end I finally close the socket. If I close the application when
> the CAN bus is idle, no problems occur. When the CAN bus is active,
> I'm getting a CAN buffer overflow after the CAN listener thread is
> closed which results in a system freeze.

This is normal behaviour (not the freeze, though). Obviously you receive
CAN messages at rather high rate and as long as the socket is open, the
ISR tries to deliver it to the socket's RX buffer and when it gets full
an error counter is increased and an error message is printed out if
debugging is enabled. See:

http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/drivers/can/rtcan_raw.c#122

> I can reproduce this problem with an easy example (see rtcanTest.c).
> This program opens a socket but it does not start a CAN listener
> thread. This results in a CAN buffer overflow when sending CAN
> messages ( using rtcansend ) and a system freeze. Executing the
> following command twice triggers the problem "rtcansend rtcan1 -l 100
> 001#00 00 00 00 00 00 00 00".
> 
> Tested with the latest xenomai 2.4 branch + CAN peak pci card.
> 
> Workaround for me is closing the socket immediately after the CAN
> listener thread is closed. Can this be a system configuration problem
> (config file attached) or a driver problem?

The problem is due to the error messages at high rate. It should be
rate-limited somehow or even be removed. Does Xenomai already have
a rtdm_printk_ratelimted function? I will have a closer look
a.s.a.p. Disabling debugging should also help.

Wolfgang.


  reply	other threads:[~2010-05-05 19:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 10:32 [Xenomai-help] System freezes when CAN buffer overflows Steven Kauffmann
2010-05-05 19:27 ` Wolfgang Grandegger [this message]
2010-05-07  9:34   ` Steven Kauffmann
2010-05-07  9:52     ` Wolfgang Grandegger
2010-05-07 10:46       ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BE1C695.10803@domain.hid \
    --to=wg@domain.hid \
    --cc=steven.kauffmann@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.