Can't call method "Delta"

Moderator: crythias

Post Reply
alexandrumateescu
Znuny newbie
Posts: 6
Joined: 26 Mar 2019, 12:17
Znuny Version: 6.0.17
Company: Retail in Motion

Can't call method "Delta"

Post by alexandrumateescu »

hi

i am seeing a very strange error in the logs and at the same time ots is showing a 500 Internal error.

It happens when you click a specific CMDB object (computer) ot when trying to search for the tickets that contain that object in the Subject.

The error is below:

ERROR: OTRS-CGI-41 Perl: 5.16.3 OS: linux Time: Tue Mar 26 09:28:08 2019

Message: Error creating DateTime object.

RemoteAddress: 192.168.210.94
RequestURI: /otrs/index.pl?Action=AgentITSMConfigItemZoom;ConfigItemID=427

Traceback (20560):
Module: Kernel::System::DateTime::new Line: 154
Module: Kernel::System::ObjectManager::_ObjectBuild Line: 306
Module: Kernel::System::ObjectManager::Create Line: 241
Module: Kernel::System::Ticket::TicketGet Line: 1347
Module: Kernel::System::LinkObject::Ticket::LinkListWithData Line: 105
Module: Kernel::System::LinkObject::LinkListWithData Line: 1251
Module: Kernel::Modules::AgentITSMConfigItemZoom::Run Line: 362
Module: Kernel::System::Web::InterfaceAgent::Run Line: 1116
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_index_2epl::handler Line: 38
Module: (eval) (v1.99) Line: 207
Module: ModPerl::RegistryCooker::run (v1.99) Line: 207
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 173
Module: ModPerl::Registry::handler (v1.99) Line: 32

[Tue Mar 26 09:28:09.506515 2019] [:error] [pid 20560] Can't call method "Delta" on an undefined value at /opt/otrs//Kernel/System/Ticket.pm line 1354.\n
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Can't call method "Delta"

Post by crythias »

https://github.com/OTRS/otrs/blob/080bf ... t.pm#L1354

Basically, it looks like (somehow) the $TicketCreatedDTObj of 1347 didn't get a value or "set" properly, so it was "null" and Delta can't be a part of "null" as an object.

It seems the database doesn't have a valid Create Time for the Ticket it's looking at.
But this also may be that the ticket itself is invalid.

There's not enough information to tell you, but do check your tables for consistency.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
alexandrumateescu
Znuny newbie
Posts: 6
Joined: 26 Mar 2019, 12:17
Znuny Version: 6.0.17
Company: Retail in Motion

Re: Can't call method "Delta"

Post by alexandrumateescu »

hi. thanks for your response.

i did check the DB from mysql and nothing seems wrong. is there an OTRS script that i might be able to run to check the DB?

Alex
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Can't call method "Delta"

Post by crythias »

The line in question:

Code: Select all

my $Delta = $TicketCreatedDTObj->Delta( DateTimeObject => $Kernel::OM->Create('Kernel::System::DateTime') );
It can't do ->Delta on an undefined object.
This means $TicketCreatedDTObj is undefined.

$TicketCreatedDTObj is based upon:

Code: Select all

    my $TicketCreatedDTObj = $Kernel::OM->Create(
        'Kernel::System::DateTime',
        ObjectParams => {
            String => $Ticket{Created}
        },
    );
Which means it builds $TicketCreatedDTObj based upon $Ticket{Created}

This is pulled from the SQL query above it.

This means that either there is no $Ticket, or the ticket.create_time is in fact invalid/empty in the database for the affected ticket.

So, even if the database is consistent, the field does not hold a valid value for the (a specific) record that is sought.

It may possibly not be a database issue, nothing to do with mysql in a table format, but may be a bad record or bad field/column in a record. Maybe see if that's possibly true in the ticket table. Sort by create_time.

There's not much more to say on a public forum about how to fix because it is specific to your data.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Post Reply