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

Can't remove shm for log: Function not implemented #2407

Closed
mkaag opened this issue Jul 20, 2023 · 4 comments
Closed

Can't remove shm for log: Function not implemented #2407

mkaag opened this issue Jul 20, 2023 · 4 comments

Comments

@mkaag
Copy link

mkaag commented Jul 20, 2023

Hello there,

there are some errors, from time to time, usually they have minimal impact on my running instance of OTOBO. However today the backend (index.pl) is not responding anymore. The frontend (public.pl and customer.pl) seems to work fine.

OTOBO v10.1.7 is running on FreeBSD 13.1 (zfs, jail) with MySQL 8.0 / redis / Apache 2.4
Restarting the jail fixed the issue.

I was creating new items in ITSM while the below error popped up in the httpd-error.log:

[Thu Jul 20 15:46:22 2023] -e: Use of uninitialized value in shmctl at /usr/local/www/otobo-rel-10_1_7/bin/psgi-bin/../../Kernel/System/Log.pm line 134.
ERROR: OTOBO-CGI-78 Perl: 5.32.1 OS: freebsd Time: Thu Jul 20 15:46:22 2023

 Message: Can't remove shm for log: Function not implemented

 RemoteAddress: x.x.x.x
 RequestURI: /otobo/index.pl?Action=AgentITSMConfigItem;SortBy=Number;OrderBy=Down;View=;Filter=26

 Traceback (33344):
   Module: Kernel::System::Log::new Line: 135
   Module: Kernel::System::ObjectManager::_ObjectBuild Line: 323
   Module: Kernel::System::ObjectManager::Get Line: 213
   Module: Kernel::Output::HTML::ITSMConfigItem::OverviewSmall::Run Line: 49
   Module: Kernel::Output::HTML::Layout::ITSMConfigItem::ITSMConfigItemListShow Line: 596
   Module: Kernel::Modules::AgentITSMConfigItem::Run Line: 327
   Module: Kernel::System::Web::InterfaceAgent::Content Line: 1239
   Module: Kernel::System::Web::InterfaceAgent::Response Line: 1321
   Module: Kernel::System::Web::App::call Line: 86
   Module: Plack::Component::__ANON__ Line: 50
   Module: Plack::App::URLMap::call Line: 71
   Module: Plack::Component::__ANON__ Line: 50
   Module: Plack::Sandbox::_2fopt_2fotobo_2fbin_2fpsgi_2dbin_2fotobo_2epsgi::__ANON__ Line: 217
   Module: Plack::Sandbox::_2fopt_2fotobo_2fbin_2fpsgi_2dbin_2fotobo_2epsgi::__ANON__ Line: 187
   Module: Plack::Sandbox::_2fopt_2fotobo_2fbin_2fpsgi_2dbin_2fotobo_2epsgi::__ANON__ Line: 173
   Module: Plack::Middleware::HTTPExceptions::try {...}  Line: 20

Thank you for this amazing software, I would not exchange it for something else!

@bschmalhofer
Copy link
Contributor

Hello Maurice,

it is interesting to see that OTOBO is actually running on FreeBSD!

I took a look at the relevant code in Kernel/System/Log.pm. The purpose of using shared memory is only to show the last log entries in the "System Log" admin frontend, that is in https://localhost/otobo/index.pl?Action=AdminLog. I assume that your security enhanced FreeBSD has security settings that deactivates the Perl builtin function shmctl, and maybe shmget. See https://perldoc.perl.org/functions/shmctl and https://perldoc.perl.org/functions/shmget.

So this message in the logfile only means that the AdminLog can't show the current system log. Therefore my guess is that these message has nothing to do with the stalled agent interface.

But there is also an error in the code, shmctl should not be called if no empty shared memory segment can be created. I will add that small improvement to OTOBO 11.0.

Best regards,
Bernhard

@mkaag
Copy link
Author

mkaag commented Jul 21, 2023

Hi Bernhard,

thank you for your reply. OTOBO is running fine on FreeBSD, it does not require much changes from Linux.
Following your response, I remembered that Jail does prevent some behavior such a memory sharing and locking. One might allows this behavior for apps running Java, MongoDB and such.

I have added the below settings for the Jail running OTOBO, and the error seems to be gone:

allow.mlock = 1;
sysvshm = new;

More details can be found on the following MAN pages:

bschmalhofer added a commit that referenced this issue Jul 21, 2023
It makes no sense to call shmctl with an undefind segment
@bschmalhofer
Copy link
Contributor

I tested the changes in a Docker based installation and found that I could see no messages in AdminLog. It is obvious that not all messages are show when there are multiple webservers in different containers. But in my devel setup only a single container was running a single preforked webserver.

It turns out that shmget() may return 0 as the ID for the first allocated shared segment. Looks like Gazelle was the first prozess to request shared memory.

bschmalhofer added a commit that referenced this issue Jul 21, 2023
This happens regularly in Docker containers, so check for
definedness instead of thruthess.
Also get rid of an useless eval.
Also explain a bit about the flags passed to shmget().
bschmalhofer added a commit that referenced this issue Jul 21, 2023
@bschmalhofer
Copy link
Contributor

Handled the case where the segment ID is 0. Manual test in Docker looks fine. Test suite looks fine. Closing this issue.

@mkaag : Merci pour le report et pour la configuration du Jail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants