you may need to install the Cpanel::API::Email module

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
Hello,

I'm getting lots of errors in the cpanel error_log file, appears like there's a loop and it's churning out this. How do I install the Cpanel::API::Email module?

v86.0.21 CloudLInux 6.10

Thanks.


[2020-06-02 01:40:06 +1000] warn [Internal Warning while parsing [stdin] 387864] Error loading module API::Email - Can't locate Cpanel/API/Email.pm in @INC (you may need to install the Cpanel::API::Email module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/530/lib/perl5/5.30.0/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/530/lib/perl5/5.30.0 /opt/cpanel/perl5/530/site_lib/x86_64-linux-64int /opt/cpanel/perl5/530/site_lib) at (eval 135) line 1.
BEGIN failed--compilation aborted at (eval 135) line 1.

at /usr/local/cpanel/Cpanel/LoadModule.pm line 27.
Cpanel::LoadModule::_logger_warn("Error loading module API::Email - Can't locate Cpanel/API/Ema"...) called at /usr/local/cpanel/Cpanel/LoadModule.pm line 170
Cpanel::LoadModule::_modloader("API::Email") called at /usr/local/cpanel/Cpanel/LoadModule.pm line 109
Cpanel::LoadModule::loadmodule("API::Email") called at /usr/local/cpanel/Cpanel/API/StatsBar.pm line 50
Cpanel::API::StatsBar::get_stats(Cpanel::Args=HASH(0x443fa48), Cpanel::Result=HASH(0x4437678)) called at /usr/local/cpanel/Cpanel/API.pm line 342
eval {...} called at /usr/local/cpanel/Cpanel/API.pm line 344
Cpanel::API::_run_module_function(Cpanel::Args=HASH(0x443fa48), Cpanel::Result=HASH(0x4437678), "StatsBar", "get_stats") called at /usr/local/cpanel/Cpanel/API.pm line 222
Cpanel::API::execute("StatsBar", "get_stats", HASH(0x36d7eb0)) called at /usr/local/cpanel/Whostmgr/API/1/Cpanel.pm line 580
Whostmgr::API::1::Cpanel::_run_uapi_for_public("oceaniaboxing", "StatsBar", "get_stats", HASH(0x36d7eb0)) called at /usr/local/cpanel/Whostmgr/API/1/Cpanel.pm line 556
Whostmgr::API::1::Cpanel::__ANON__() called at /usr/local/cpanel/Cpanel/AccessIds/ReducedPrivileges.pm line 93
eval {...} called at /usr/local/cpanel/Cpanel/AccessIds/ReducedPrivileges.pm line 93
Cpanel::AccessIds::ReducedPrivileges::call_as_user("oceaniaboxing", CODE(0x36d8198)) called at /usr/local/cpanel/Whostmgr/API/1/Cpanel.pm line 556
Whostmgr::API::1::Cpanel::uapi_cpanel(HASH(0x36d7eb0), Whostmgr::API::1::Utils::Metadata=HASH(0x36d4c48), HASH(0x36d4b40)) called at whostmgr/bin/xml-api.pl line 3750
whostmgr::bin::xml_api::__ANON__(Whostmgr::API::1::Utils::Metadata=HASH(0x36d4c48), HASH(0x36d7eb0), HASH(0x36d4b40), undef) called at /usr/local/cpanel/Whostmgr/API/1/Data/Wrapper.pm line 234
Whostmgr::API::1::Data::Wrapper::__ANON__() called at /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/Try/Tiny.pm line 97
eval {...} called at /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/Try/Tiny.pm line 88
Try::Tiny::try(CODE(0x36d7fe8), Try::Tiny::Catch=REF(0x36d1630)) called at /usr/local/cpanel/Whostmgr/API/1/Data/Wrapper.pm line 253
Whostmgr::API::1::Data::Wrapper::execute_internal(CODE(0x43e64d0), HASH(0x36d7eb0), HASH(0x36d4b40), HASH(0x36d4c30), undef) called at whostmgr/bin/xml-api.pl line 3925
whostmgr::bin::xml_api::runapp("uapi_cpanel", HASH(0x36d4b40), HASH(0x36d7eb0), 1, undef) called at whostmgr/bin/xml-api.pl line 4001
eval {...} called at whostmgr/bin/xml-api.pl line 4001
whostmgr::bin::xml_api::batch_runapp(HASH(0x17e7188), Whostmgr::API::1::Utils::Metadata=HASH(0x17dff70), HASH(0x3614b00)) called at whostmgr/bin/xml-api.pl line 3750
whostmgr::bin::xml_api::__ANON__(Whostmgr::API::1::Utils::Metadata=HASH(0x17dff70), HASH(0x17e7188), HASH(0x3614b00), CODE(0x3612898)) called at /usr/local/cpanel/Whostmgr/API/1/Data/Wrapper.pm line 234
Whostmgr::API::1::Data::Wrapper::__ANON__() called at /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/Try/Tiny.pm line 97
eval {...} called at /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/Try/Tiny.pm line 88
Try::Tiny::try(CODE(0x361f4d0), Try::Tiny::Catch=REF(0x3623590)) called at /usr/local/cpanel/Whostmgr/API/1/Data/Wrapper.pm line 253
Whostmgr::API::1::Data::Wrapper::execute_internal(CODE(0x361a100), HASH(0x17e7188), HASH(0x3614b00), HASH(0x361a430), CODE(0x3612898)) called at whostmgr/bin/xml-api.pl line 3925
whostmgr::bin::xml_api::runapp("batch", HASH(0x3614b00), HASH(0x16d17d8), 0, CODE(0x3612898)) called at whostmgr/bin/xml-api.pl line 3619
whostmgr::bin::xml_api::script(CODE(0x3612898), "-json", "./batch") called at whostmgr/bin/xml-api.pl line 3562
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,249
313
Houston
@bloatedstoat I don't see really any reports of this specific error, I know I don't have that Perl module in my test server at /usr/local/cpanel/Cpanel/API/ nor am I able to find that module when running cpan or /scripts/perlinstaller

Do you have any customizations/plugins on that cPanel account and is it happening for others or just the oceaniaboxing account?
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,249
313
Houston
It actually looks like it's related to the stats bar, this portion of the UI (at least that's what looks like is being attributed to it)

Screenshot at Jun 03 18-01-44.png

This may look a bit different on CloudLinux and you might want to try update CageFS before anything else? I know I dug through a ton of tickets yesterday trying to find anything that called that specific API and struck out.
 

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
Thanks @cPanelLauren

Yeah I forced the cagefs update to no avail.
This is happening twice per day at defined intervals 12 hours apart, it's not random.

There is a similarity with post 5 of Bandwidth usage issues - it contains the near-identical chunk of code.
I wasn't able to pull anything useful from the post unfortunately but it is coincidental. My stats_log does not show any errors as in the linked post.
 

cPanelLauren

Technical Support Community Manager
Staff member
Nov 14, 2017
13,304
1,249
313
Houston
Yea I saw that too and it's because something was broken with POP3 Bandwidth calculations but this seems to be different. What time do you run stats? You can find the configuration at WHM>>Server Configuration>>Statistics Software Configuration

Not sure if it's quite the same but worth a shot.
 

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
Always worth a shot @cPanelLauren ....

I disabled all the stats software yesterday. All 3 unchecked. Yet the issue persists.

The frequency for processing is set to:
Web Traffic Statistics every 24 hours
Bandwidth Statistics every 2 hours

So neither of those marry up with twice a day.
 

Secmas

Well-Known Member
Feb 18, 2005
350
9
168
Hi.
I am joining in as I have the exact behavior with my servers.

I updated cagefsctl:
Code:
cagefsctl --force-udpate
cagefsctl -M
but didn't help to fix this.

My log about a few minutes ago shows:
Code:
[2020-06-04 19:15:55 -0600] warn [Internal Warning while parsing [stdin] 17795] Error loading module API::Email - Can't locate Cpanel/API/Email.pm in @INC (you may need to install the Cpanel::API::Email module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/530/lib/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/530/lib/perl5/5.30.0/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/530/lib/perl5/5.30.0 /opt/cpanel/perl5/530/site_lib/x86_64-linux-64int /opt/cpanel/perl5/530/site_lib) at (eval 21) line 1.
BEGIN failed--compilation aborted at (eval 21) line 1.
Sergio
 
  • Like
Reactions: bloatedstoat

cPSamuelM

Technical Analyst Team Lead
Staff member
Nov 20, 2019
182
31
103
USA
cPanel Access Level
Root Administrator
Hello,

I'm curious to know if you are using a custom cPanel theme. I see references to an old API function:

Cpanel::API::execute("StatsBar", "get_stats", HASH(0x36d7eb0)) called at /usr/local/cpanel/Whostmgr/API/1/Cpanel.pm line 580

https://documentation.cpanel.net/display/DD/cPanel+API+2+Functions+-+StatsBar::stat

The cPanel API has been replaced by UAPI. Is it possible that an old cPanel theme or template might still be referring to the old API on your servers?
 

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
It's possible @cPSamuel but I wouldn't have done it. I have made no mods to any templates on this server.

Regular as clockwork though the errors are churned out twice per day 12 hours apart so there's a cron job or something calling a script.

crontab -l shows no entries for the times the errors start.
 

cPSamuelM

Technical Analyst Team Lead
Staff member
Nov 20, 2019
182
31
103
USA
cPanel Access Level
Root Administrator
Helllo again @bloatedstoat

Thanks for your update. I recommend you submit a ticket using the link in my signature. While reviewing our past support requests and documentation for errors including "Error loading module API::Email" I did not find any conclusive details that would apply in your scenario. This is worthy of further investigation so we can help you get to the bottom of the issue.
 

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
This is definitely WHMCS.
I updated the password within the whmcs settings and bingo the log file was filled with errors again.

WHMCS Version: 7.10.2
PHP Version 7.3.18

08/06/2020 01:40
Automated Task: Starting Tenant Usage Metrics

08/06/2020 13:40
Automated Task: Starting Tenant Usage Metrics
 
Last edited:

Secmas

Well-Known Member
Feb 18, 2005
350
9
168
What password did you change in WHMCS, the users cPanel password or the server password under server definitions?
 

bloatedstoat

Well-Known Member
Jun 14, 2012
173
22
68
Victoria, Australia
cPanel Access Level
Root Administrator
I updated the server password first. Errors vanished. This server hosts our whmcs.

Then in whmcs I went into "Setup > Products/Services > Servers" and updated the root password for the server. Errors returned.

I've tracked it down to these tasks running - they match the cpanel error log.

08/06/2020 01:40
Automated Task: Starting Tenant Usage Metrics

08/06/2020 13:40
Automated Task: Starting Tenant Usage Metrics

I have currently set the whmcs module to debug to try and see what's going on, the next run is a 4 hours away so once I have more I'll update this thread.
 
  • Like
Reactions: cPSamuelM

Secmas

Well-Known Member
Feb 18, 2005
350
9
168
@bloatedstoat
Did you manage to solve this issue?
Today I got again the same errors.
If you fixed it, Would you be kind to write the steps to fix it?

Regards,
Sergio