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

Log spam: Exiting subroutine via last at... #1811

Closed
fraenki opened this issue Jun 6, 2022 · 5 comments
Closed

Log spam: Exiting subroutine via last at... #1811

fraenki opened this issue Jun 6, 2022 · 5 comments
Assignees
Labels
bug Something isn't working as intended
Milestone

Comments

@fraenki
Copy link
Contributor

fraenki commented Jun 6, 2022

When using nested LDAP groups in Otobo 10.1.4, the log is spammed with debug information on every logon:

[Mon Jun  6 17:51:21 2022] -e: Exiting eval via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.
[Mon Jun  6 17:51:21 2022] -e: Exiting subroutine via last at /opt/otobo-10.1.4/bin/psgi-bin/../../Kernel/System/Auth/Sync/LDAP.pm line 963.

Is there a setting to disable these messages, or is this a bug?

@bschmalhofer bschmalhofer self-assigned this Jun 6, 2022
@bschmalhofer bschmalhofer added the bug Something isn't working as intended label Jun 6, 2022
@bschmalhofer bschmalhofer added this to the OTOBO 10.1.5 milestone Jun 6, 2022
@bschmalhofer
Copy link
Contributor

Hi Frank, @fraenki ,

this looks like a bug to me. The label MATCH is used for exiting the loop before the label is declared. A quick fix could be to move the line 965 MATCH:to the line 957, just before for my $Value ( @{$MemberValues} ) {.

But in #1573 I have a refactored version of this code. Could you check https://github.com/RotherOSS/otobo/blob/issue-%231573-ldap_tidying_take3/Kernel/System/Auth/Sync/LDAP.pm whether the logic is still intact? Furthermore, could you check whether the refactored version works for you? If so, we would include it in the upcoming patch level release OTOBO 10.1.5.

Best regards,
Bernhard

@svenoe svenoe modified the milestones: OTOBO 10.1.5, OTOBO 10.1.6 Jun 20, 2022
@bschmalhofer
Copy link
Contributor

Here is some sample code for seeing what is going on:

bes:~/devel/OTOBO/otobo (issue-#1573-tidying)$ cat t_eval.pm 
use v5.24;
use warnings;

my $xx = 1;
my $sub = sub {
        eval {
            for my $Value ( 2, 4, 8, 16, 32 ) {

                $xx = $Value;

                # stop if we found a match
                last MATCH if $xx > 10;
            }

            # abort on LDAP errors
            die 'yyyyyyyyyyyyyyyyyy';
        };
say "xx: $xx";
        return $xx;
};

my $res = $sub->();
say "res: $res";

bes:~/devel/OTOBO/otobo (issue-#1573-tidying)$ perl t_eval.pm 
Exiting eval via last at t_eval.pm line 12.
Exiting subroutine via last at t_eval.pm line 12.
xx: 16
res: 16

The label MATCH is not found. Thus it exits the encloding eval block and prints the warnings. This means that we can move the label to before the for loop. But then we must take precaution to not run into the die statement.

bschmalhofer added a commit that referenced this issue Oct 10, 2022
Issue #1811: minimal fix for avoiding warnings
@bschmalhofer
Copy link
Contributor

bschmalhofer commented Oct 10, 2022

Applied a patch that silences the warning. Closing this issue. But the larger issue #1573 is still open.

@fraenki
Copy link
Contributor Author

fraenki commented Oct 10, 2022

@bschmalhofer, thanks for taking care of this! 👍 I've got distracted by other work and forgot to reply...

@bschmalhofer
Copy link
Contributor

Thanks for the feedback.
I also updated the PR for #1573, so it would be appreciated if you could try out the new version of LDAP.pm. https://github.com/RotherOSS/otobo/blob/issue-%231573-ldap_tidying_take3/Kernel/System/Auth/Sync/LDAP.pm. I did some cleanup there, but never got around it to really test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

3 participants