public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "dsmith at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/15147] New: _stp_error() doesn't behave as described
Date: Wed, 13 Feb 2013 22:10:00 -0000	[thread overview]
Message-ID: <bug-15147-6586@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2013-02-13 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 22:10 dsmith at redhat dot com [this message]
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

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=bug-15147-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.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 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).