public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug runtime/15147] New: _stp_error() doesn't behave as described
@ 2013-02-13 22:10 dsmith at redhat dot com
  2013-02-13 22:16 ` [Bug runtime/15147] " dsmith at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2013-02-13 22:10 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15147

             Bug #: 15147
           Summary: _stp_error() doesn't behave as described
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: runtime
        AssignedTo: systemtap@sourceware.org
        ReportedBy: dsmith@redhat.com
    Classification: Unclassified


According to the documentation string for _stp_error():

/** Prints error message and exits.                                             
 * This function sends an error message immediately to staprun. It              
 * will also be sent over the bulk transport (relayfs) if it is                 
 * being used. If the last character is not a newline, then one                 
 * is added.                                                                    
 *                                                                              
 * After the error message is displayed, the module will be unloaded.           
 * @param fmt A variable number of args.                                        
 * @sa _stp_exit().                                                             
 */                                                                             

This documentation is (sort of) true, but doesn't match what happens in other
error situations.

For example:

====
# stap -ge 'function error_test(str:string) %{ _stp_error(STAP_ARG_str); %}
probe begin { error_test("error 1"); printf("after 1st error\n");
error_test("error 2"); printf("after 2nd error\n"); } probe end {
printf("exiting\n") }'
ERROR: error 1
ERROR: error 2
after 1st error
after 2nd error
exiting
WARNING: /usr/local/bin/staprun exited with status: 1
Pass 5: run failed.  [man error::pass5]
====

Here's the same script, but instead of calling _stp_error() we set
CONTEXT->last_error:

====
stap -ge 'function error_test(str:string) %{ CONTEXT->last_error =
STAP_ARG_str; %} probe begin { error_test("error 1"); printf("after 1st
error\n"); error_test("error 2"); printf("after 2nd error\n"); } probe end {
printf("exiting\n") }'
ERROR: error 1 near identifier 'error_test' at <input>:1:10
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /usr/local/bin/staprun exited with status: 1
Pass 5: run failed.  [man error::pass5]
====

Notice the differences - the probe exited immediately (instead of running the
entire begin probe), stap reported that 1 error had occurred, and the 'end'
probe didn't get run.

The documentation states that the module "will be unloaded". While true, it
isn't unloaded immediately like it does in other error situations.

At a minimum the documentation for _stp_error() should be improved. A more
ambitious approach would be to reimplement it with CONTEXT->last_error or
remove _stp_error(). (If removal is chosen, _stp_softerror() is another
candidate for removal.) 

Note this is somewhat related to bug #14738, which states that _stp_error() is
being overused.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/15147] _stp_error() doesn't behave as described
  2013-02-13 22:10 [Bug runtime/15147] New: _stp_error() doesn't behave as described dsmith at redhat dot com
@ 2013-02-13 22:16 ` dsmith at redhat dot com
  2013-02-13 22:46 ` fche at redhat dot com
  2013-02-13 23:12 ` fche at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2013-02-13 22:16 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15147

--- Comment #1 from David Smith <dsmith at redhat dot com> 2013-02-13 22:16:20 UTC ---
In addition, errors reported by _stp_error() (or _stp_soft_error()) can't be
caught with try/catch.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/15147] _stp_error() doesn't behave as described
  2013-02-13 22:10 [Bug runtime/15147] New: _stp_error() doesn't behave as described dsmith at redhat dot com
  2013-02-13 22:16 ` [Bug runtime/15147] " dsmith at redhat dot com
@ 2013-02-13 22:46 ` fche at redhat dot com
  2013-02-13 23:12 ` fche at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fche at redhat dot com @ 2013-02-13 22:46 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15147

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fche at redhat dot com

--- Comment #2 from Frank Ch. Eigler <fche at redhat dot com> 2013-02-13 22:46:42 UTC ---
_stp_error is not documented or intended for stap users.  Though it looks like
the same sort of marked-up documentation that tapsets use, this is only a
historical accident.  We're free to rename it to ... e.g. _stp_error_message()
or something, to better explain what it does.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug runtime/15147] _stp_error() doesn't behave as described
  2013-02-13 22:10 [Bug runtime/15147] New: _stp_error() doesn't behave as described dsmith at redhat dot com
  2013-02-13 22:16 ` [Bug runtime/15147] " dsmith at redhat dot com
  2013-02-13 22:46 ` fche at redhat dot com
@ 2013-02-13 23:12 ` fche at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fche at redhat dot com @ 2013-02-13 23:12 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=15147

Frank Ch. Eigler <fche at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> 2013-02-13 23:12:17 UTC ---
commit 56bda00 tweaks the comment

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-13 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 22:10 [Bug runtime/15147] New: _stp_error() doesn't behave as described dsmith at redhat dot com
2013-02-13 22:16 ` [Bug runtime/15147] " dsmith at redhat dot com
2013-02-13 22:46 ` fche at redhat dot com
2013-02-13 23:12 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).