[Bug 1764] RTEMS shell not always waiting for termination

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Mar 15 08:11:45 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1764

--- Comment #2 from dufault at hda.com 2011-03-15 03:11:44 CDT ---
(In reply to comment #1)
> (In reply to comment #1)
> > Sometimes two shells startup at the console and they get every other character
> > of input. 
> 
> With 2 shells running the input effect is expected. There are 2 threads blocked
> in the read call.

I know.

> 
> > Observe, this is after a reset:
> > 
> > RTEMS SHELL (Ver.1.0-FRC):/dev/console. Mar 11 2011. 'help' to list commands.   
> > [/] #                                                                           
> > RTEMS SHELL (Ver.1.0-FRC):/dev/console. Mar 11 2011. 'help' to list commands.   
> > [/] # eecchhoo  121212                                                          
> > 111                                                                             
> > [/] #                                                                           

... Eliding startup code that looks fine and task dump that shows two SHLC
tasks ...
> 
> That look fine.
> 
> > This is a problem because I typically start my applications with a shell with
> > an optional startup file, and when this happens my application doesn't start
> > right, and it sometimes fails in the field.  It happens very rarely.  This is
> > happening in 4.11, but it also happened in 4.10.
> 
> I am not sure I follow this so this is what I understand.
> 
> When you run with no startup script you do not see a problem how-ever when you
> run a startup script you something see a problem of the shell that runs the
> script does not terminate and you then create a new shell.

No, now I'm doing development and have no startup script.  After reset two
shells start up at the console, which makes no sense given the "while (1)" code
I showed earlier.  I've seen this occasionally (but rarely) in 4.10 and in the
field, and in the field the result is the application doesn't start properly
and must be restarted.  I've maybe noticed this four times.

Another possibility is that it isn't a second shell starting up but somehow two
calls to my  POSIX_Init() resulting in two calls to my main_thread starting two
shells.  I've copied my POSIX_Init() below.  main_thread() has that "while(1)
start rtems shell" loop I showed earlier.  Too bad I didn't invoke "pthread" as
well as "task" when this happened,  we'd see if there were two "_init" threads
running.  If I see it again I'll do that.

void * POSIX_Init(void)
{
    int r;

    rtems_object_set_name(pthread_self(), "_init" );

    if ( (r = ppc_exc_set_handler(ASM_BOOKE_WDOG_VECTOR,
mpc55xx_wdt_interrupt_handler)) ) {
            fprintf(stderr,
                "ppc_exc_set_handler(%d, %p) returned %d.\n",
                ASM_BOOKE_WDOG_VECTOR, mpc55xx_wdt_interrupt_handler, r);
            return (void *)r;
    }
    mpc55xx_watchdog_enable_interrupt(1);

    application_post_reset();   /* Let the application do anything it need to.
*/

    rtems_bsdnet_initialize_network();
    rtems_telnetd_initialize();
    if ( rpcUdpInit() || nfsInit(0, 0)) {
        fprintf(stderr, "Can't start NFS.\n");
    }

#if MONGOOSE
    if (mongoose_start_at_boot && mongoose_at_boot()) {
        fprintf(stderr, "Can't start mongoose thread.\n");
    }
#endif

    return main_thread(NULL);
}

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list