glpi-inventory-plugin icon indicating copy to clipboard operation
glpi-inventory-plugin copied to clipboard

"No active session" when agents with scheduled tasks try to communicate with the server

Open redddcyclone opened this issue 1 month ago • 11 comments

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • [x] I have searched the existing issues

GLPI Version

11.0.2

Plugin version

1.6.1

Bug description

Hello

I'm getting this error when some agents that have tasks scheduled to them try to contact the server (prolog request):

[2025-11-05 12:48:23] glpi.ERROR:   *** Caught RuntimeException: No active session
  Backtrace :
  ./src/Session.php:2407
  ./src/Glpi/Features/AssignableItem.php:176         Session::getCurrentProfile()
  ./src/Glpi/Features/AssignableItem.php:114         Computer::getAssignableVisiblityCriteriaForHelpdesk()
  ./src/Glpi/Search/Provider/SQLProvider.php:1109    Computer::getAssignableVisiblityCriteria()
  ./src/Search.php:614                               Glpi\Search\Provider\SQLProvider::getDefaultWhereCriteria()
  ./src/Glpi/Search/Provider/SQLProvider.php:4236    Search::addDefaultWhere()
  ./src/Search.php:259                               Glpi\Search\Provider\SQLProvider::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:244 Search::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:276 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
  ...ins/glpiinventory/inc/deploygroup.class.php:643 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
  ./plugins/glpiinventory/inc/toolbox.class.php:356  PluginGlpiinventoryDeployGroup::getTargetsForGroup()
  ...ugins/glpiinventory/inc/taskview.class.php:1021 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
  ./plugins/glpiinventory/inc/taskview.class.php:835 PluginGlpiinventoryTaskView->getAgentsFromActors()
  ./plugins/glpiinventory/inc/task.class.php:642     PluginGlpiinventoryTaskView->prepareTaskjobs()
  ./src/CronTask.php:885                             PluginGlpiinventoryTask::cronTaskscheduler()
  ./front/cron.php:135                               CronTask::launch()

[2025-11-05 09:48:29] glpi.CRITICAL:   *** Uncaught PHP Exception RuntimeException: "No active session" at Session.php line 2407
  Backtrace :
  ./src/Session.php:2407
  ./src/Glpi/Features/AssignableItem.php:176         Session::getCurrentProfile()
  ./src/Glpi/Features/AssignableItem.php:114         Computer::getAssignableVisiblityCriteriaForHelpdesk()
  ./src/Glpi/Search/Provider/SQLProvider.php:1109    Computer::getAssignableVisiblityCriteria()
  ./src/Search.php:614                               Glpi\Search\Provider\SQLProvider::getDefaultWhereCriteria()
  ./src/Glpi/Search/Provider/SQLProvider.php:4236    Search::addDefaultWhere()
  ./src/Search.php:259                               Glpi\Search\Provider\SQLProvider::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:244 Search::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:276 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
  ...ins/glpiinventory/inc/deploygroup.class.php:643 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
  ./plugins/glpiinventory/inc/toolbox.class.php:356  PluginGlpiinventoryDeployGroup::getTargetsForGroup()
  ...ugins/glpiinventory/inc/taskview.class.php:1021 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
  ./plugins/glpiinventory/inc/task.class.php:425     PluginGlpiinventoryTaskView->getAgentsFromActors()
  ...gins/glpiinventory/public/b/deploy/index.php:59 PluginGlpiinventoryTask->getTaskjobstatesForAgent()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

On the Agent log, I get the same: [Wed Nov 5 09:48:17 2025][error] [http client] communication error: 500 Internal Server Error, No active session

I think this started happening after updating GLPI to 11.0.2 or the plugin to 1.6.1, I can't tell exactly... as I don't remember having this error yesterday.

Thanks a lot

Relevant log output


Page URL

No response

Steps To reproduce

  1. Create a task
  2. Target it to a computer
  3. Enable the task and have the server schedule it to the computer
  4. Have the computer's agent send the prolog request

Your GLPI setup information

GLPI information
GLPI: 11.0.2 ( => /var/www/glpi)
Installation mode: TARBALL
Current language: pt_BR
Source Integrity: 1 files changed
  A: inc/downstream.php
Server
Operating system: Linux srvglpi 6.15.6 #​1 SMP PREEMPT_DYNAMIC Mon Jul 14 09:50:50 -03 2025 x86_64

PHP: 8.3.19 fpm-fcgi

PHP extensions: Core, date, libxml, hash, pcre, zlib, filter, json, SPL, random, Reflection, session, standard, openssl, sockets, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, intl, ldap, exif, mysqlnd, PDO, Phar, SimpleXML, sqlite3, tokenizer, xml, xmlwriter, xsl, mysqli, pdo_mysql, pdo_sqlite, sodium, xmlreader, zip, redis, Zend OPcache

Setup: disable_functions="" max_execution_time="86400" max_input_vars="10000" memory_limit="1024M" post_max_size="8M" session.cookie_secure="1" session.cookie_httponly="1" session.cookie_samesite="Lax" session.save_handler="files" upload_max_filesize="2M"

Web server: nginx/1.26.3 ()

User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0

Database:

Server Software: MariaDB Server

Server Version: 10.11.11-MariaDB

Server SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Parameters: glpi_usr@localhost/glpi

Host info: Localhost via UNIX socket

Requirements: PHP version (8.3.19) is supported. OS and PHP are relying on 64 bits integers. Sessions configuration is OK. Allocated memory is sufficient. Following extensions are installed: dom, fileinfo, filter, libxml, simplexml, tokenizer, xmlreader, xmlwriter. mysqli extension is installed curl extension is installed gd extension is installed intl extension is installed mbstring extension is installed zlib extension is installed bcmath extension is installed The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present. openssl extension is installed Database engine version (10.11.11) is supported. The log file has been created successfully. Write access to /var/lib/glpi/_cache has been validated. Write access to /var/lib/glpi/_cron has been validated. Write access to /var/lib/glpi has been validated. Write access to /var/lib/glpi/_graphs has been validated. Write access to /var/lib/glpi/_lock has been validated. Write access to /var/lib/glpi/_pictures has been validated. Write access to /var/lib/glpi/_plugins has been validated. Write access to /var/lib/glpi/_rss has been validated. Write access to /var/lib/glpi/_sessions has been validated. Write access to /var/lib/glpi/_tmp has been validated. Write access to /var/lib/glpi/_uploads has been validated. SELinux configuration is OK.

Sessions configuration is secured. exif extension is installed ldap extension is installed Following extensions are installed: bz2, Phar, zip. Zend OPcache extension is installed Following extensions are installed: ctype, iconv, sodium. Write access to /var/www/glpi/marketplace has been validated. Timezones seems loaded in database.

GLPI constants
GLPI_ROOT: "/var/www/glpi"
GLPI_VERSION: "11.0.2"
GLPI_SCHEMA_VERSION: "11.0.2@ea2dbba0e1edbf5128d73bdb23c2c9b9f68468ba"
GLPI_FILES_VERSION: "11.0.2-52505ef9"
GLPI_MIN_PHP: "8.2"
GLPI_MAX_PHP: "8.5"
GLPI_YEAR: "2025"
GLPI_I18N_DIR: "/var/www/glpi/locales"
GLPI_CONFIG_DIR: "/etc/glpi/"
GLPI_VAR_DIR: "/var/lib/glpi"
GLPI_LOG_DIR: "/var/log/glpi"
GLPI_ENVIRONMENT_TYPE: "production"
GLPI_MARKETPLACE_DIR: "/var/www/glpi/marketplace"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["~^\n                        (http|https|feed)://
# protocol\n (\n (?:\n
(?:xn--[a-z0-9-]++\.)+xn--[a-z0-9-]++ # a domain name using punycode\n
|\n (?:[\pL\pN\pS\pM\-\]++\.)+[\pL\pN\pM]++ # a multi-level domain name\n |\n [a-z0-9\-\]++
# a single-level domain name\n )\.?\n |
# or\n \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
# an IP address\n | # or\n \[\n
(?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::))))\n \] # an IPv6 address\n
)\n (?:/ (?:[\pL\pN\pS\pM\-._\~!$&'()
+,;=:@]|%[0-9A-Fa-f]{2})* )* # a path\n
(?:\? (?:[\pL\pN\-._\~!$&'\\+,;=:@/?]|%[0-9A-Fa-f]{2}) )? # a query (optional)\n
$~ixuD"] GLPI_DISALLOWED_UPLOADS_PATTERN: "/\.(php\d*|phar)$/i" GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org" GLPI_INSTALL_MODE: "TARBALL" GLPI_NETWORK_MAIL: "[email protected]" GLPI_NETWORK_SERVICES: "https://services.glpi-network.com" GLPI_MARKETPLACE_ENABLE: 3 GLPI_MARKETPLACE_PRERELEASES: false GLPI_MARKETPLACE_ALLOW_OVERRIDE: true GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true GLPI_USER_AGENT_EXTRA_COMMENTS: "" GLPI_DOCUMENTATION_ROOT_URL: "https://links.glpi-project.org" GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1" GLPI_LOG_LVL: "warning" GLPI_SKIP_UPDATES: false GLPI_STRICT_ENV: false GLPI_AJAX_DASHBOARD: "1" GLPI_CALDAV_IMPORT_STATE: 0 GLPI_CENTRAL_WARNINGS: "1" GLPI_SYSTEM_CRON: false GLPI_TEXT_MAXSIZE: "4000" GLPI_WEBHOOK_ALLOW_RESPONSE_SAVING: "0" GLPI_WEBHOOK_CRA_MANDATORY: false GLPI_ALTCHA_MODE: "interactive" GLPI_ALTCHA_MAX_NUMBER: 50000 GLPI_ALTCHA_EXPIRATION_INTERVAL: "PT20M" GLPI_DOC_DIR: "/var/lib/glpi" GLPI_CACHE_DIR: "/var/lib/glpi/_cache" GLPI_CRON_DIR: "/var/lib/glpi/_cron" GLPI_GRAPH_DIR: "/var/lib/glpi/_graphs" GLPI_LOCAL_I18N_DIR: "/var/lib/glpi/_locales" GLPI_LOCK_DIR: "/var/lib/glpi/_lock" GLPI_PICTURE_DIR: "/var/lib/glpi/_pictures" GLPI_PLUGIN_DOC_DIR: "/var/lib/glpi/_plugins" GLPI_RSS_DIR: "/var/lib/glpi/_rss" GLPI_SESSION_DIR: "/var/lib/glpi/_sessions" GLPI_TMP_DIR: "/var/lib/glpi/_tmp" GLPI_UPLOAD_DIR: "/var/lib/glpi/_uploads" GLPI_INVENTORY_DIR: "/var/lib/glpi/_inventories" GLPI_THEMES_DIR: "/var/lib/glpi/_themes" GLPI_PLUGINS_DIRECTORIES: ["/var/www/glpi/marketplace","/var/www/glpi/plugins"] GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/" GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/marketplace/"
Réplicas SQL
Not active
Notifications
Way of sending emails: SMTP(smtp://glpi:********@mail.domain:587?verify_peer=0)
Plugins list
glpiinventory        Name: GLPI Inventory                 Version: 1.6.1      State: Habilitado
Install Method: Manual

Anything else?

No response

redddcyclone avatar Nov 05 '25 12:11 redddcyclone

Please try https://github.com/glpi-project/glpi/pull/21812 (this fix is on GLPI). There is not much that can be done plugin side so far.

trasher avatar Nov 05 '25 13:11 trasher

Hi @trasher

Tried it. Looks like the cron related error does not happen anymore, but my agent still can't contact the server.

I still got this error: [Wed Nov 5 10:53:22 2025][error] [http client] communication error: 500 Internal Server Error, No active session

And on php-errors.log, I got the following again after applying the fix, but I don't know where exactly it came from, as it does not seem to be related to the agent error (it did not happen at the same time, the agent is getting this 500 error every minute but nothing is logged on php-errors.log):

[2025-11-05 10:51:56] glpi.CRITICAL:   *** Uncaught PHP Exception RuntimeException: "No active session" at Session.php line 2407
  Backtrace :
  ./src/Session.php:2407
  ./src/Glpi/Features/AssignableItem.php:179         Session::getCurrentProfile()
  ./src/Glpi/Features/AssignableItem.php:117         Computer::getAssignableVisiblityCriteriaForHelpdesk()
  ./src/Glpi/Search/Provider/SQLProvider.php:1109    Computer::getAssignableVisiblityCriteria()
  ./src/Search.php:614                               Glpi\Search\Provider\SQLProvider::getDefaultWhereCriteria()
  ./src/Glpi/Search/Provider/SQLProvider.php:4236    Search::addDefaultWhere()
  ./src/Search.php:259                               Glpi\Search\Provider\SQLProvider::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:244 Search::constructSQL()
  ...ntory/inc/deploygroup_dynamicdata.class.php:276 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
  ...ins/glpiinventory/inc/deploygroup.class.php:643 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
  ./plugins/glpiinventory/inc/toolbox.class.php:356  PluginGlpiinventoryDeployGroup::getTargetsForGroup()
  ...ugins/glpiinventory/inc/taskview.class.php:1021 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
  ./plugins/glpiinventory/inc/task.class.php:425     PluginGlpiinventoryTaskView->getAgentsFromActors()
  ...gins/glpiinventory/public/b/deploy/index.php:59 PluginGlpiinventoryTask->getTaskjobstatesForAgent()
  ...Glpi/Controller/LegacyFileLoadController.php:64 require()
  ./vendor/symfony/http-kernel/HttpKernel.php:181    Glpi\Controller\LegacyFileLoadController->__invoke()
  ./vendor/symfony/http-kernel/HttpKernel.php:76     Symfony\Component\HttpKernel\HttpKernel->handleRaw()
  ./vendor/symfony/http-kernel/Kernel.php:197        Symfony\Component\HttpKernel\HttpKernel->handle()
  ./public/index.php:70                              Symfony\Component\HttpKernel\Kernel->handle()

redddcyclone avatar Nov 05 '25 13:11 redddcyclone

@redddcyclone could you please try the change I propose here: https://github.com/glpi-project/glpi/pull/21812#pullrequestreview-3422326616?

trasher avatar Nov 05 '25 14:11 trasher

After enabling debug on GLPI-Agent, I can see that the error is logged on php-errors.log when I try to access the following URL without authenticating: https://srvglpi/plugins/glpiinventory/b/collect/?action=getJobs&machineid=machine-2024-04-12-15-16-14

redddcyclone avatar Nov 05 '25 14:11 redddcyclone

@trasher tried the latest change you mentioned, but it did not fix the problem

redddcyclone avatar Nov 05 '25 14:11 redddcyclone

OK, thank you

trasher avatar Nov 05 '25 14:11 trasher

Sorry, I replied with a message in the proposal’s comment, but it seems it’s still pending:

It’s working for me 👍 (I had the same issue as @redddcyclone). @redddcyclone, it’s normal that if you request the same task twice in a row via URL, the second one fails, since it’s understood that it was already requested and ends up in the “In error” state.

ka0tik0 avatar Nov 06 '25 18:11 ka0tik0

@ka0tik0 thanks for the report! So it seems that the problem is fixed

redddcyclone avatar Nov 06 '25 18:11 redddcyclone

After a few days of testing, I’ve noticed a small issue with a plugin we usually use for SAML access (samlsoo). I’ve reported the incident, but I think it might be related to this topic, since when that plugin is enabled, inventories work correctly, but deploy and collect tasks do not. The error logged by the agent is: [http client] Can't decode JSON content, starting with:

<link rel="preconn ...

ka0tik0 avatar Nov 07 '25 12:11 ka0tik0

There is nothing much we can do if another plugin adds something; it miust be fixed on the other side.

trasher avatar Nov 07 '25 12:11 trasher

After a few days of testing, I’ve noticed a small issue with a plugin we usually use for SAML access (samlsoo). I’ve reported the incident, but I think it might be related to this topic, since when that plugin is enabled, inventories work correctly, but deploy and collect tasks do not. The error logged by the agent is: [http client] Can't decode JSON content, starting with:

<link rel="preconn ...

Make sure endpoints that should not be authed are excluded in the samlsso config>excludes.

DonutsNL avatar Nov 07 '25 14:11 DonutsNL

Hi all

can you try this -> https://github.com/glpi-project/glpi-inventory-plugin/pull/800

Best regards

stonebuzz avatar Nov 10 '25 08:11 stonebuzz

Hi all

can you try this -> #800

This is also related to https://github.com/glpi-project/glpi/pull/21812

trasher avatar Nov 10 '25 08:11 trasher

Hi all can you try this -> #800

This is also related to glpi-project/glpi#21812

With latests changes, GLPI core changes are no longer required. I'm not able to reproduce the initial issue, so please @redddcyclone @ka0tik0 check if #800 solves the issue.

trasher avatar Nov 10 '25 08:11 trasher

After a few days of testing, I’ve noticed a small issue with a plugin we usually use for SAML access (samlsoo). I’ve reported the incident, but I think it might be related to this topic, since when that plugin is enabled, inventories work correctly, but deploy and collect tasks do not. The error logged by the agent is: [http client] Can't decode JSON content, starting with: <link rel="preconn ...

Make sure endpoints that should not be authed are excluded in the samlsso config>excludes.

Wow, I'm really sorry... I missed the exclusions... Thank you so much!

ka0tik0 avatar Nov 10 '25 08:11 ka0tik0

Hi @trasher, I'll try it. Should I remove the changes you made on glpi-project/glpi#21812?

Edit: added the changes mentioned in #800, tasks are still working. I did not remove the changes I mentioned above though

redddcyclone avatar Nov 10 '25 12:11 redddcyclone

Changes on core does not affect the fix; it does not mayter if you get them applied or not.

Thanks for the feedback.

trasher avatar Nov 10 '25 13:11 trasher