Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ugly exception during initial installation #109

Open
stdweird opened this issue Jun 8, 2016 · 3 comments
Open

ugly exception during initial installation #109

stdweird opened this issue Jun 8, 2016 · 3 comments

Comments

@stdweird
Copy link
Member

stdweird commented Jun 8, 2016

AII postinstall output

does not really look like an issue, but is ugly nonetheless

2016-06-08T13:45:37.194679+02:00 node2626.swalot.os AII:   Installing : ncm-cdispd-16.2.1-SNAPSHOT20160510054357.noarch            80/94 
2016-06-08T13:45:37.199290+02:00 node2626.swalot.os AII: Uncaught exception!!! Calling stack is:
2016-06-08T13:45:37.202091+02:00 node2626.swalot.os AII:   LC::Exception::throw_error called at /usr/lib/perl/EDG/WP4/CCM/Fetch/Config.pm line 89
2016-06-08T13:45:37.204628+02:00 node2626.swalot.os AII:   EDG::WP4::CCM::Fetch::Config::setCacheRoot called at /sbin/ccm-fetch line 264
2016-06-08T13:45:37.207164+02:00 node2626.swalot.os AII: *** directory does not exist: /var/lib/ccm
2016-06-08T13:45:37.209643+02:00 node2626.swalot.os AII: Stopping ncm-cdispd:[FAILED]#015
2016-06-08T13:45:37.212240+02:00 node2626.swalot.os AII: Starting ncm-cdispd:[  OK  ]#015
@stdweird stdweird added this to the 16.8 milestone Jun 8, 2016
@stdweird stdweird modified the milestones: 16.10, 16.8 Aug 5, 2016
@stdweird
Copy link
Member Author

stdweird commented Aug 5, 2016

my analysis: we are using the LC::Exception completely wrong
the magic lines

$ec = LC::Exception::Context->new->will_store_errors

that are sprinkled over all our modules actually initiate a new context for each module.
in this case, the context in the main cannot see the exception thrown in a module.

we could track all the exceptions using private variable (%LC::Exception::Context::_Active), but why do we have more than one?

i propose to add a function to CAF::Object (as it already re-exports throw_error) to intialise (if it's the first usage) or return the active quattor exception context; and use that throughout the code instead of the oneliner above. (Also support using an explicit context name is passed in which case a context with that name is used (instead of default name quattor)).

This function would be a combination of LC::Exception::Context->new and LC::Exception::Context::active.

i would also add a function to scan all active exceptions and check if any of them has an error, and return that error.

will this cause problems: probably. as there is only one context, any code currently resetting the previously local one, will now reset the global one. that why the second function might be handy.
it should be safe to use in refactored modules, as they are used to build a single instance of something.

example: dump of all active contexts for the reported issue:

$VAR1 = {
          'ccm' => bless( {
                            '_eh' => sub { "DUMMY" },
                            '_wh' => $VAR1->{'ccm'}{'_eh'}
                          }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Element' => bless( {
                                               '_eh' => $VAR1->{'ccm'}{'_eh'}
                                             }, 'LC::Exception::Context' ),
          'CAF::Object' => bless( {
                                    '_eh' => $VAR1->{'ccm'}{'_eh'},
                                    '_wh' => $VAR1->{'ccm'}{'_eh'}
                                  }, 'LC::Exception::Context' ),
          'CAF::Application' => bless( {
                                         '_eh' => $VAR1->{'ccm'}{'_eh'},
                                         '_wh' => $VAR1->{'ccm'}{'_eh'}
                                       }, 'LC::Exception::Context' ),
          'CAF::Log' => bless( {
                                 '_eh' => $VAR1->{'ccm'}{'_eh'},
                                 '_wh' => $VAR1->{'ccm'}{'_eh'}
                               }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Fetch' => bless( {
                                             '_eh' => $VAR1->{'ccm'}{'_eh'}
                                           }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Configuration' => bless( {
                                                     '_eh' => $VAR1->{'ccm'}{'_eh'}
                                                   }, 'LC::Exception::Context' ),
          'LC::Check' => bless( {
                                  '_eh' => $VAR1->{'ccm'}{'_eh'}
                                }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Resource' => bless( {
                                                '_eh' => $VAR1->{'ccm'}{'_eh'}
                                              }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::SyncFile' => bless( {
                                                '_eh' => $VAR1->{'ccm'}{'_eh'}
                                              }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::CacheManager' => bless( {
                                                    '_eh' => $VAR1->{'ccm'}{'_eh'}
                                                  }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Fetch::Config' => bless( {
                                                     '_eh' => $VAR1->{'ccm'}{'_eh'}
                                                   }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Property' => bless( {
                                                '_eh' => $VAR1->{'ccm'}{'_eh'}
                                              }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::Path' => bless( {
                                            '_eh' => $VAR1->{'ccm'}{'_eh'}
                                          }, 'LC::Exception::Context' ),
          'EDG::WP4::CCM::CCfg' => bless( {
                                            '_eh' => $VAR1->{'ccm'}{'_eh'}
                                          }, 'LC::Exception::Context' ),
          'LC::File' => bless( {
                                 '_eh' => $VAR1->{'ccm'}{'_eh'}
                               }, 'LC::Exception::Context' )
        };
Uncaught exception!!! Calling stack is:
  LC::Exception::throw_error called at /usr/lib/perl/EDG/WP4/CCM/Fetch/Config.pm line 89
  EDG::WP4::CCM::Fetch::Config::setCacheRoot called at /usr/sbin/ccm-fetch line 276
*** directory does not exist: /var/lib/ccm

@stdweird
Copy link
Member Author

one case where a global EC won't work: in ComponentProxy, each component package is checked for their own EC, and it's a possible different one than the one from component proxy itself.

@piojo-zz
Copy link
Member

piojo-zz commented Oct 5, 2016

Consensus is to get rid of LC::Exception altogether. Have CAF::Die or similar to log the error and then actually croak, so that we can get an exception.

@jrha jrha modified the milestones: 17.2, 16.10 Oct 19, 2016
@jrha jrha modified the milestones: 17.3, 17.2 Feb 10, 2017
@jrha jrha modified the milestones: 17.6, 17.3 Mar 22, 2017
@jouvin jouvin modified the milestones: 17.4, 17.6 Mar 22, 2017
@ned21 ned21 modified the milestones: 17.6, 17.4 Mar 22, 2017
@jrha jrha removed this from the 17.8 milestone Sep 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants