Search code examples
perlubuntuencodingmimeotrs

OTRS PostmasterMailbox.pl parsing/MIME type


After upgrading from Ubuntu Server 12.04 to Ubuntu 14.04 LTS i started having parsing issues with my otrs installation. I was running OTRS 3.1.1 with mysql 5.5 and perl 5.18. I thought it might be the fact that I had an old OTRS version so following the steps on the OTRS manual decided to upgrade to OTRS 3.2.1, mysql 5.6 and ugpraded almost all the perl modules + apache to 2.4.7

I did so and everything worked fine but the issue with the parsing persists. OTRS uses a script via a cronjob to fetch emails from a mailbox and create tickets. On many of the tickets it fails to parse them causing the system to hang on a specific mail and open continuously the same ticket and then dies (without parsing the other mails in queue).

any ideas ?

    # /opt/otrs/bin/otrs.PostMasterMailbox.pl -f 1
    Useless use of '\'; doesn't escape metacharacter '{' at /opt/otrs/Kernel/System/VariableCheck.pm line 290.
    In '(?...)', splitting the initial '(?' is deprecated in regex; marked by <-- HERE in m/
            (                                          # $1 greater-than and less-than sign
                > | < | \s+ | \#{6} |
                (?: &[a-zA-Z0-9]+; )                   # get html entities
            )
            (                                          # $2
                (?:                                    # http or only www
                    (?: (?: http s? | ftp ) :\/\/) |   # http://,https:// and ftp://
                    (?: (?: www | ftp ) \.)            # www. and ftp.
                )
            )
            (                                          # $3
                (?: [a-z0-9\-]+ \. )*                  # get subdomains, optional
                [a-z0-9\-]+                            # get top level domain
                (?:                                    # file path element
                    [\/\.]
                    | [a-zA-Z0-9\-]
                )*
                (?:                                    # param string
                    [\?]                               # if param string is there, "?" must be present
                    [a-zA-Z0-9&;=%]*                   # param string content, this will also catch entities like &amp;
                )?
                (?:                                    # link hash string
                    [\#]                               #
                    [a-zA-Z0-9&;=%]*                   # hash string content, this will also catch entities like &amp;
                )?
            )
            (                                          # $4
                ? <-- HERE =(?:
                    [\?,;!\.\)] (?: \s | $ )           # \)\s this construct is because of bug# 2450
                    | \"
                    | \]
                    | \s+
                    | '
                    | >                               # greater-than and less-than sign
                    | <                               # "
                    | (?: &[a-zA-Z0-9]+; )+            # html entities
                    | $                                # bug# 2715
                )
                | \#{6}                                # ending LinkHash
            )
        / at /opt/otrs/Kernel/System/HTMLUtils.pm line 867.

IMAP: Connection to mailserver closed.

IMAP: Connection to mailserver closed.

IMAP: Connection to mailserver closed.

IMAP: Connection to mailserver  closed.

IMAP: Connection to mailserver  closed.

IMAP: Message 1/5 (account/mailserver )
No valid 'utf-8' string: ' ....

...

open body: Invalid argument at /opt/otrs/Kernel/cpan-lib/MIME/Entity.pm line 1872.

edit: checked the apache logs and I get lots of redefinitions as below :

[Sat Jun 21 19:44:20 2014] GeneralCatalog.pm: Subroutine ItemAdd redefined at /opt/otrs/Kernel/System/GeneralCatalog.pm line 461.
[Sat Jun 21 19:44:20 2014] GeneralCatalog.pm: Subroutine ItemUpdate redefined at /opt/otrs/Kernel/System/GeneralCatalog.pm line 569.
[Sat Jun 21 19:44:20 2014] GeneralCatalog.pm: Subroutine GeneralCatalogPreferencesSet redefined at /opt/otrs/Kernel/System/GeneralCatalog.pm line 678.
[Sat Jun 21 19:44:20 2014] GeneralCatalog.pm: Subroutine GeneralCatalogPreferencesGet redefined at /opt/otrs/Kernel/System/GeneralCatalog.pm line 697.
[Sat Jun 21 19:44:20 2014] LayoutImportExport.pm: Subroutine ImportExportFormInputCreate redefined at /opt/otrs//Kernel/Output/HTML/LayoutImportExport.pm line 31.
[Sat Jun 21 19:44:20 2014] LayoutImportExport.pm: Subroutine ImportExportFormDataGet redefined at /opt/otrs//Kernel/Output/HTML/LayoutImportExport.pm line 66.
[Sat Jun 21 19:44:20 2014] LayoutImportExport.pm: Subroutine _ImportExportLoadLayoutBackend redefined at /opt/otrs//Kernel/Output/HTML/LayoutImportExport.pm line 100.
[Sat Jun 21 19:44:20 2014] PreferencesDB.pm: Subroutine new redefined at /opt/otrs//Kernel/System/GeneralCatalog/PreferencesDB.pm line 72.
[Sat Jun 21 19:44:20 2014] PreferencesDB.pm: Subroutine GeneralCatalogPreferencesSet redefined at /opt/otrs//Kernel/System/GeneralCatalog/PreferencesDB.pm line 105.
[Sat Jun 21 19:44:20 2014] PreferencesDB.pm: Subroutine GeneralCatalogPreferencesGet redefined at /opt/otrs//Kernel/System/GeneralCatalog/PreferencesDB.pm line 152.

Solution

  • You posted a long trace of error messages, mostly depreciation warnings of regex features from perl 5.18.

    The actual problem was this:

    open body: Invalid argument at /opt/otrs/Kernel/cpan-lib/MIME/Entity.pm line 1872.
    

    That issue was also caused by a change in Perl 5.18, and fixed in OTRS 3.2.12. You should upgrade your 3.2.1 to the latest patch version of 3.2.x. http://bugs.otrs.org/show_bug.cgi?id=9832

    EDIT: it has also been fixed in 3.3.1 so if you'd upgrade to latest 3.3.x patch level release (i.e. 3.3.8 at this time) you'd be fine too!

    BTW in a later 3.2.x version the regex depreciation warnings are also gone!