glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.3k stars 1.29k forks source link

glpisqllog.ERROR: DBmysql::query() in /var/www/html/g952/inc/dbmysql.class.php line 306 #8129

Closed jcervantes-sipecom closed 3 years ago

jcervantes-sipecom commented 4 years ago

Describe the bug When trying to access the main page of tickets (front/ticket.php), it does not finish loading, leaving completely blank, and the loading never completes. I have to restart Apache2 and Mysql to be able to enter the main page.

Page(s) URL

front/ticket.php

To reproduce

Steps to reproduce the behavior:

  1. Go to 'Assistance'
  2. Click on 'Tickets'
  3. See error: Tickets page doesn't load, the entire server got slow.

Expected behavior

Show the ticket page and all tickets.

Logs sql-errors.log

I had to reduce the log file to be able to upload, but originally this was 150mb. A partial portion of the sql-errors.log:

glpisqllog.ERROR: DBmysql::query() in /var/www/html/g952/inc/dbmysql.class.php line 306
  *** MySQL query error:
  SQL: SELECT COUNT(*) AS cpt FROM `glpi_calendars_holidays` INNER JOIN `glpi_holidays` ON (`glpi_calendars_holidays`.`holidays_id` = `glpi_holidays`.`id`) WHERE `glpi_calendars_holidays`.`calendars_id` = '1' AND (((`glpi_holidays`.`end_date` >= '1545-07-10' AND `glpi_holidays`.`begin_date` <= '1545-07-10')) OR ((`glpi_holidays`.`is_perpetual` = '1' AND MONTH(`end_date`)*100 + DAY(`end_date`) >= 710 AND MONTH(`begin_date`)*100 + DAY(`begin_date`) <= 710)))
  Error: MySQL server has gone away
  Backtrace :
  inc/dbmysqliterator.class.php:95
  inc/dbmysql.class.php:857                          DBmysqlIterator->execute()
  inc/calendar.class.php:276                         DBmysql->request()
  inc/calendar.class.php:328                         Calendar->isHoliday()
  inc/search.class.php:5882                          Calendar->getActiveTimeBetween()
  inc/search.class.php:1457                          Search::giveItem()
  inc/search.class.php:320                           Search::constructData()
  inc/search.class.php:95                            Search::getDatas()
  inc/search.class.php:80                            Search::showList()
  front/ticket.php:50                                Search::show()

Screenshots

image

After some time later I got this error on browser: image

Your GLPI setup (you can find it in Setup > General menu, System tab)


[code]   GLPI 9.5.2 (/g952 => /var/www/html/g952) Installation mode: TARBALL
--

Operating system: Linux sg01ilinv3sipe 4.15.0-121-generic #123-Ubuntu SMP Mon Oct 5 16:16:40 UTC 2020 x86_64 PHP 7.2.24-0ubuntu0.18.04.7 apache2handler (Core, PDO, PDO_ODBC, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler,   apc, apcu, bz2, calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imagick, imap, intl,   json, ldap, libxml, mbstring, memcache, mysqli, mysqlnd, odbc, openssl, pcre, pdo_mysql, posix, pspell, readline, recode,   session, shmop, snmp, soap, sockets, sodium, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc,    xmlwriter, xsl, zip, zlib) Setup: max_execution_time="300" memory_limit="-1" post_max_size="8M" safe_mode="" session.save_handler="files"   upload_max_filesize="2M"  Software: Apache/2.4.29 (Ubuntu) (Apache/2.4.29 (Ubuntu) Server at 10.1.3.75 Port 80)     Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 OPR/71.0.3770.228 (Edition Campaign 34) Server Software: mariadb.org binary distribution    Server Version: 10.4.15-MariaDB-1:10.4.15+maria~bionic-log  Server SQL Mode:    Parameters: glpi@localhost/g9495    Host info: Localhost via UNIX socket     PHP version is at least 7.2.0 - Perfect! Sessions support is available - Perfect! Unlimited memory - Perfect! mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed intl extension is installed ldap extension is installed apcu extension is installed Zend OPcache extension is installed xmlrpc extension is installed CAS extension is installed exif extension is installed zip extension is installed bz2 extension is installed sodium extension is installed Database version seems correct (10.4.15) - Perfect! Timezones seems loaded in database The log file has been created successfully. Write access to /var/www/html/g952/config has been validated. Write access to /var/www/html/g952/files has been validated. Write access to /var/www/html/g952/files/_dumps has been validated. Write access to /var/www/html/g952/files/_sessions has been validated. Write access to /var/www/html/g952/files/_cron has been validated. Write access to /var/www/html/g952/files/_graphs has been validated. Write access to /var/www/html/g952/files/_lock has been validated. Write access to /var/www/html/g952/files/_plugins has been validated. Write access to /var/www/html/g952/files/_tmp has been validated. Write access to /var/www/html/g952/files/_cache has been validated. Write access to /var/www/html/g952/files/_rss has been validated. Write access to /var/www/html/g952/files/_uploads has been validated. Write access to /var/www/html/g952/files/_pictures has been validated. Write access to /var/www/html/g952/marketplace has been validated. Web access to files directory is protected

GLPI_ROOT: /var/www/html/g952 GLPI_CONFIG_DIR: /var/www/html/g952/config GLPI_VAR_DIR: /var/www/html/g952/files GLPI_MARKETPLACE_DIR: /var/www/html/g952/marketplace GLPI_USE_CSRF_CHECK: 1 GLPI_CSRF_EXPIRES: 7200 GLPI_CSRF_MAX_TOKENS: 100 GLPI_TELEMETRY_URI: https://telemetry.glpi-project.org GLPI_INSTALL_MODE: TARBALL GLPI_NETWORK_MAIL: glpi@teclib.com GLPI_NETWORK_SERVICES: https://services.glpi-network.com GLPI_MARKETPLACE_PRERELEASES:  GLPI_USER_AGENT_EXTRA_COMMENTS:  GLPI_AJAX_DASHBOARD: 1 GLPI_CALDAV_IMPORT_STATE: 0 GLPI_DEMO_MODE: 0 GLPI_FORCE_EMPTY_SQL_MODE: 1 GLPI_DOC_DIR: /var/www/html/g952/files GLPI_CACHE_DIR: /var/www/html/g952/files/_cache GLPI_CRON_DIR: /var/www/html/g952/files/_cron GLPI_DUMP_DIR: /var/www/html/g952/files/_dumps GLPI_GRAPH_DIR: /var/www/html/g952/files/_graphs GLPI_LOCAL_I18N_DIR: /var/www/html/g952/files/_locales GLPI_LOCK_DIR: /var/www/html/g952/files/_lock GLPI_LOG_DIR: /var/www/html/g952/files/_log GLPI_PICTURE_DIR: /var/www/html/g952/files/_pictures GLPI_PLUGIN_DOC_DIR: /var/www/html/g952/files/_plugins GLPI_RSS_DIR: /var/www/html/g952/files/_rss GLPI_SESSION_DIR: /var/www/html/g952/files/_sessions GLPI_TMP_DIR: /var/www/html/g952/files/_tmp GLPI_UPLOAD_DIR: /var/www/html/g952/files/_uploads GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/ GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/ GLPI_I18N_DIR: /var/www/html/g952/locales GLPI_VERSION: 9.5.2 GLPI_SCHEMA_VERSION: 9.5.2 GLPI_MIN_PHP: 7.2.0 GLPI_YEAR: 2020

htmlawed/htmlawed version 1.2.5 in (/var/www/html/g952/vendor/htmlawed/htmlawed) phpmailer/phpmailer version 6.1.6 in (/var/www/html/g952/vendor/phpmailer/phpmailer/src) simplepie/simplepie version 1.5.5 in (/var/www/html/g952/vendor/simplepie/simplepie/library) tecnickcom/tcpdf version 6.3.5 in (/var/www/html/g952/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/var/www/html/g952/vendor/michelf/php-markdown/Michelf) true/punycode in (/var/www/html/g952/vendor/true/punycode/src) iamcal/lib_autolink in (/var/www/html/g952/vendor/iamcal/lib_autolink) sabre/dav in (/var/www/html/g952/vendor/sabre/dav/lib/DAV) sabre/http in (/var/www/html/g952/vendor/sabre/http/lib) sabre/uri in (/var/www/html/g952/vendor/sabre/uri/lib) sabre/vobject in (/var/www/html/g952/vendor/sabre/vobject/lib) laminas/laminas-cache in (/var/www/html/g952/vendor/laminas/laminas-cache/src) laminas/laminas-i18n in (/var/www/html/g952/vendor/laminas/laminas-i18n/src) laminas/laminas-serializer in (/var/www/html/g952/vendor/laminas/laminas-serializer/src) monolog/monolog in (/var/www/html/g952/vendor/monolog/monolog/src/Monolog) sebastian/diff in (/var/www/html/g952/vendor/sebastian/diff/src) elvanto/litemoji in (/var/www/html/g952/vendor/elvanto/litemoji/src) symfony/console in (/var/www/html/g952/vendor/symfony/console) scssphp/scssphp in (/var/www/html/g952/vendor/scssphp/scssphp/src) laminas/laminas-mail in (/var/www/html/g952/vendor/laminas/laminas-mail/src/Protocol) laminas/laminas-mime in (/var/www/html/g952/vendor/laminas/laminas-mime/src) rlanvin/php-rrule in (/var/www/html/g952/vendor/rlanvin/php-rrule/src) blueimp/jquery-file-upload in (/var/www/html/g952/vendor/blueimp/jquery-file-upload/server/php) ramsey/uuid in (/var/www/html/g952/vendor/ramsey/uuid/src) psr/log in (/var/www/html/g952/vendor/psr/log/Psr/Log) psr/simple-cache in (/var/www/html/g952/vendor/psr/simple-cache/src) mexitek/phpcolors in (/var/www/html/g952/vendor/mexitek/phpcolors/src/Mexitek/PHPColors) guzzlehttp/guzzle in (/var/www/html/g952/vendor/guzzlehttp/guzzle/src) guzzlehttp/psr7 in (/var/www/html/g952/vendor/guzzlehttp/psr7/src) wapmorgan/unified-archive in (/var/www/html/g952/vendor/wapmorgan/unified-archive/src) paragonie/sodium_compat in (/var/www/html/g952/vendor/paragonie/sodium_compat/src) phpCas version 1.3.3 in (/usr/share/php)

accounts             Name: Accounts                       Version: 2.5.0      State: Installed / not activated  activity             Name: Activities                     Version: 2.5.0      State: Installed / not activated  actualtime           Name: ActualTime                     Version: 1.3.1      State: Installed / not activated  fields               Name: Additionnal fields             Version: 1.10.3     State: Installed / not activated  news                 Name: Alerts                         Version: 1.6.0      State: Installed / not activated  archisw              Name: Apps structures                Version: 2.1.3      State: Installed / not activated  cleanarchivedemails  Name: Archived eMail clean           Version: 1.3.1      State: Installed / not activated  impacts              Name: Asset impacts                  Version: 1.3.7      State: Installed / not activated  barcode              Name: Barcode                        Version: 2.4.1      State: Installed / not activated  behaviors            Name: Behaviours                     Version: 2.3.0      State: Installed / not activated  positions            Name: Cartography                    Version: 4.6.0      State: Installed / not activated  childticketmanager   Name: Child ticket manager           Version: 2.1.3      State: Installed / not activated  consumables          Name: Consumable request             Version: 1.5.0      State: Installed / not activated  costs                Name: Costs                          Version: 1.2.0      State: Installed / not activated  credit               Name: Credit vouchers                Version: 1.6.2      State: Installed / not activated  dashboard            Name: Dashboard                      Version: 0.9.9      State: Installed / not activated  mydashboard          Name: Dashboard access               Version: 1.7.8      State: Installed / not activated  databases            Name: Databases                      Version: 2.2.1      State: Installed / not activated  dataflows            Name: Dataflows                      Version: 2.1.0      State: Installed / not activated  archimap             Name: Diagrams                       Version: 2.1.3      State: Installed / not activated  domains              Name: Domains                        Version: 2.1.0      State: Installed / not activated  dporegister          Name: DPO Register                   Version: 1.4        State: Installed / not activated  manageentities       Name: Entities portal                Version: 3.1.0      State: Installed / not activated  environment          Name: Environment                    Version: 2.3.0      State: Installed / not activated  escalade             Name: Escalation                     Version: 2.4.4      State: Installed / not activated  datainjection        Name: File injection                 Version: 2.7.0      State: Installed / not activated  financialreports     Name: Financial reports              Version: 2.6.0      State: Installed / not activated  formcreator          Name: Form Creator                   Version: 2.10.1     State: Installed / not activated  formvalidation       Name: Form Validation                Version: 0.6.8      State: Installed / not activated  fpconsumables        Name: FP Consumables                 Version: 1.3.0      State: Installed / not activated  fpsoftware           Name: FP Software                    Version: 1.4.0      State: Installed / not activated  archifun             Name: Functional Areas               Version: 2.1.0      State: Installed / not activated  fusioninventory      Name: FusionInventory                Version: 9.4+2.4    State: Installed / not activated  gappessentials       Name: Gapp Essentials                Version: 1.1.0      State: Installed / not activated  gdrive               Name: GDrive                         Version: 1.2.0      State: Installed / not activated  mod                  Name: GLPI Modifications             Version: 1.5.5      State: Installed / not activated  resources            Name: Human Resources                Version: 2.6.3      State: Installed / not activated  geninventorynumber   Name: Inventory number generation    Version: 2.4.1      State: Installed / not activated  addressing           Name: IP Adressing                   Version: 2.8.0      State: Installed / not activated  uninstall            Name: Item's Lifecycle (uninstall)   Version: 2.6.3      State: Installed / not activated  itilcategorygroups   Name: ItilCategory Groups            Version: 2.3.0      State: Installed / not activated  mailanalyzer         Name: Mail Analyzer                  Version: 1.6.1      State: Installed / not activated  mask                 Name: Mask                           Version: 2.3.0      State: Installed / not activated  metademands          Name: Meta-Demands                   Version: 2.6.0      State: Installed / not activated  metabase             Name: metabase                       Version: 1.0.0      State: Installed / not activated  mreporting           Name: More Reporting                 Version: 1.6.1      State: Installed / not activated  satisfaction         Name: More satisfaction              Version: 1.4.3      State: Installed / not activated  moreticket           Name: More ticket                    Version: 1.5.1      State: Installed / not activated  notifications        Name: Notifications                  Version: 9.4+1.0    State: Installed / not activated  genericobject        Name: Objects management             Version: 2.8.0      State: Installed / not activated  ocsinventoryng       Name: OCS Inventory NG               Version: 1.6.0      State: Installed / not activated  officeonline         Name: Office Online                  Version: 1.3.2      State: Installed / not activated  order                Name: Orders management              Version: 2.5.3      State: Installed / not activated  additionalalerts     Name: Others alerts                  Version: 2.2.0      State: Installed / not activated  pdf                  Name: Print to pdf                   Version: 1.6.0      State: Installed / not activated  printercounters      Name: Printer counters               Version: 1.6.0      State: Installed / not activated  processmaker         Name: Process Maker                  Version: 3.6.5      State: Installed / not activated  reports              Name: Reports                        Version: 1.13.1     State: Installed / not activated  reservation          Name: Reservation                    Version: 2.2.0      State: Installed / not activated  shellcommands        Name: Shell Commands                 Version: 2.3.0      State: Installed / not activated  statecheck           Name: Statecheck Rules               Version: 2.1.0      State: Installed / not activated  manufacturersimports Name: Suppliers imports              Version: 2.2.0      State: Installed / not activated  tag                  Name: Tag Management                 Version: 2.6.0      State: Installed / not activated  taskdrop             Name: TaskDrop                       Version: 1.1.0      State: Installed / not activated  tasklists            Name: Tasks list                     Version: 1.5.1      State: Installed / not activated  ticketcleaner        Name: Ticket Cleaner                 Version: 2.5.1      State: Installed / not activated  timelineticket       Name: Timeline of tickets            Version: 9.4+1.0    State: Installed / not activated  timezones            Name: Timezones                      Version: 2.5.2      State: Installed / not activated  treeview             Name: Tree view                      Version: 1.8.1      State: Installed / not activated  typology             Name: Typologies                     Version: 2.6.0      State: Installed / not activated  useditemsexport      Name: Used items export              Version: 2.3.0      State: Installed / not activated  webapplications      Name: Web applications               Version: 2.6.0      State: Installed / not activated  yagp                 Name: yagp                           Version: 1.0.1      State: Installed / not activated
[/code]

Additional context

Checking the logs, I found there is a loop with the portion of SQL before. I also find I'm not the only one with this problem:

https://github.com/glpi-project/glpi/issues/6010

I delete the SLA from Setup > Service Levels. The problem persist.

https://forum.glpi-project.org/viewtopic.php?id=166949

Same error with me.

https://forum.glpi-project.org/viewtopic.php?id=36582

Same error with no answer

This problem start when I was on 9.4.6 version, and I update to 9.5.2 hoping this was the solution but nothing. All the plugins are deactivate, so it's not a plugin error.

cedric-anne commented 4 years ago

Hi,

Dates are pretty weird in your SQL logs. Can you check on glpi_tickets database table if there is a *date field that contains a value far in the past or far in the future ?

Regards

jcervantes-sipecom commented 4 years ago

Hi, yes I did this query (Sorry if the query is not optimal or perfect, I am not a DBA, but I got the data I wanted.):

select date,closedate,solvedate,date_mod,date_creation from g9495.glpi_tickets where year(cast(date as datetime))<>'2020' and year(cast(date as datetime))<>'2019' or year(cast(closedate as datetime))<>'2020' and year(cast(closedate as datetime))<>'2019' or year(cast(solvedate as datetime))<>'2020' and year(cast(solvedate as datetime))<>'2019' or year(cast(date_mod as datetime))<>'2020' and year(cast(date_mod as datetime))<>'2019' or year(cast(date_creation as datetime))<>'2020' and year(cast(date_creation as datetime))<>'2019' \G;

I got some values pretty weird like (attach txt): glpi_tickets.txt

closedate: 2038-01-18 22:14:07 solvedate: 2038-01-18 22:14:07 closedate: NULL date: 0000-00-00 00:00:00

I don't know how these values are there, but is there any way to fix it?

trasher commented 4 years ago

I dunno for the "0" date; for 2038, see https://github.com/glpi-project/glpi/issues/7953

cedric-anne commented 4 years ago

Hi,

SLA/OLA computations may use the date field as begin date, and, for each iteration, check if target date is in working days. Setting date with date_creation value when date == '0000-00-00 00:00:00' should fix your issue.

Regards

jcervantes-sipecom commented 4 years ago

Hi, thanks for your answers. For:

I dunno for the "0" date; for 2038, see #7953

I don't think this is the problem, but thanks anyway.

For:

Hi,

SLA/OLA computations may use the date field as begin date, and, for each iteration, check if target date is in working days. Setting date with date_creation value when date == '0000-00-00 00:00:00' should fix your issue.

Regards

Sorry I don't know how to setting date with date_creation value when date == '0000-00-00 00:00:00' as I said I delete SLA/OLA if this setting is done there.

image

cedric-anne commented 4 years ago

Sorry I don't know how to setting date with date_creation value when date == '0000-00-00 00:00:00' as I said I delete SLA/OLA if this setting is done there.

Not sure that deleting SLA/OLA will remove computed SLA/OLA date from tickets table, so, you should try this query: UPDATE `glpi_tickets` SET `date` = `date_creation` WHERE `date` = '0000-00-00 00:00:00';.

jcervantes-sipecom commented 4 years ago

Hi, I wrote earlier that this was the solution:

You should try this query: UPDATE `glpi_tickets` SET `date` = `date_creation` WHERE `date` = '0000-00-00 00:00:00';.

And partly it was, now I can view the tickets page and it loads. However, I had to delete it because the slowness continues and after a few minutes the following window appears:

image

Before this happens I can see in the button "Display debug information", which takes time to open when clicked, the following:

9944 Queries took 0.451s

And from line 440 the following command is executed:

SELECT COUNT() AS cpt FROM glpi_calendars_holidays INNER JOIN glpi_holidays ON (glpi_calendars_holidays.holidays_id = glpi_holidays.id) WHERE glpi_calendars_holidays.calendars_id = '1' AND (((glpi_holidays.end_date >= '2020-10-23' AND glpi_holidays.begin_date <= '2020-10-23')) OR ((glpi_holidays.is_perpetual = '1' AND MONTH(end_date)100 + DAY(end_date) >= 1023 AND MONTH(begin_date)*100 + DAY(begin_date) <= 1023)))

Up to line 6736, it runs:

SELECT COUNT() AS cptFROM glpi_calendars_holidaysINNER JOIN glpi_holidays ON (glpi_calendars_holidays.holidays_id = glpi_holidays.id)WHERE glpi_calendars_holidays.calendars_id = '1' AND (((glpi_holidays.end_date >= '2038-01-18' AND glpi_holidays.begin_date <= '2038-01-18')) OR ((glpi_holidays.is_perpetual = '1' AND MONTH(end_date)100 + DAY(end_date) >= 118 AND MONTH(begin_date)*100 + DAY(begin_date) <= 118)))

Then stop, and from line 6854 execute the code again:

SELECT COUNT() AS cpt FROM glpi_calendars_holidays INNER JOIN glpi_holidays ON (glpi_calendars_holidays.holidays_id = glpi_holidays.id) WHERE glpi_calendars_holidays.calendars_id = '1' AND (((glpi_holidays.end_date >= '2020-03-12' AND glpi_holidays.begin_date <= '2020-03-12')) OR ((glpi_holidays.is_perpetual = '1' AND MONTH(end_date)100 + DAY(end_date) >= 312 AND MONTH(begin_date)*100 + DAY(begin_date) <= 312)))

Up to line 7057, it runs:

SELECT COUNT() AS cpt FROM glpi_calendars_holidays INNER JOIN glpi_holidays ON (glpi_calendars_holidays.holidays_id = glpi_holidays.id) WHERE glpi_calendars_holidays.calendars_id = '1' AND (((glpi_holidays.end_date >= '2020-10-01' AND glpi_holidays.begin_date <= '2020-10-01')) OR ((glpi_holidays.is_perpetual = '1' AND MONTH(end_date)100 + DAY(end_date) >= 1001 AND MONTH(begin_date)*100 + DAY(begin_date) <= 1001)))

It seems that this repetitive query causes the loading of the tickets page to be delayed.

Also in "Display (number of items)" it is 100.

cedric-anne commented 4 years ago

Checks on holidays can lead to a huge amount of DB queries depending on SLA/OLA durations and on calendars configuration. I do not know if this is the cause of your issue. Can you try with #7990 ?

jcervantes-sipecom commented 4 years ago

Hi, thanks for your answer. Sorry I didn't know how to apply this patch, so I did my research. I did:

curl -L https://github.com/glpi-project/glpi/pull/7990.patch > /tmp/7990.patch git apply /tmp/7990.patch

I got a problem with a folder that I didn't have "tests". I check the files and folder on this page, in CODE, and I found out that there is a folder "tests" that isn't in Releases. So I download this folder, and did again:

git apply /tmp/7990.patch service apache2 restart

And then I got this:

image

And again the tickets are not displayed.

cedric-anne commented 4 years ago

Hi,

Maybe you have invalid values in time_to_resolve, time_to_own, begin_waiting_date, ola_ttr_begin_date, internal_time_to_resolve, internal_time_to_own.

I added a commit to #7990 (e40b89a5989b694e663edae7ec6077a3a5ac05ce) that add a workaround to limit checks on holidays if distance between 2 dates seems illegitimate (I set this threshold to 2 years), but the real solution requires lots of work, and I am not sure to be able to implement it in a short delay.

Regards

jcervantes-sipecom commented 4 years ago

Hello, I made the change manually because when trying to apply the patch I got this error:

error: patch failed: inc/calendar.class.php:241 error: inc/calendar.class.php: patch does not apply error: patch failed: inc/calendar_holiday.class.php:206 error: inc/calendar_holiday.class.php: patch does not apply error: patch failed: tests/functionnal/Calendar.php:186 error: tests/functionnal/Calendar.php: patch does not apply error: patch failed: tests/functionnal/Calendar.php:269 error: tests/functionnal/Calendar.php: patch does not apply

Anyway, once the inc/calendar.class.php file was modified I was able to open the Tickets page and the "Display debug information" button no longer showed that repetitive iteration, it was faster to load the page: 3304 Queries took 0.275s

cedric-anne commented 4 years ago

Hi,

I keep this issue opened as I would like to find better than just a workaround.

You can take a look at your logs, you should see messages like Distance between "%s" and "%s" is too important, time computation will ignore holidays parameters., where %s are dates. It may help you to identify which value seems incorrect in your database, and maybe fix it.

Regards

cedric-anne commented 3 years ago

Hi @jcervantes-sipecom ,

I found another solution to speed-up SLA/OLA computation. Can you check if #8413 fixes your performances issues ?

Regards

jcervantes-sipecom commented 3 years ago

Hi @jcervantes-sipecom ,

I found another solution to speed-up SLA/OLA computation. Can you check if #8413 fixes your performances issues ?

Regards

Hi @cedric-anne, sorry for the delay I was really bussy. I updated to 9.5.3, do I the before patch still apply? or does the last Glpi versión already has it?

trasher commented 3 years ago

@jcervantes-sipecom referenced pull request has not been merged; so no, this is not currently part of GLPI.

jcervantes-sipecom commented 3 years ago

ok I will try it right now.

jcervantes-sipecom commented 3 years ago

Hello, sorry I did not send the error I got, I did these steps:

curl -L https://patch-diff.githubusercontent.com/raw/glpi-project/glpi/pull/8413.patch > /tmp/8413.patch

cd /var/www/html/glpi/

 git apply /tmp/8413.patch

and got the following:

warning: inc/calendar.class.php has type 100755, expected 100644
warning: inc/calendar_holiday.class.php has type 100755, expected 100644
warning: inc/holiday.class.php has type 100755, expected 100644
error: tests/functionnal/Calendar.php: No such file or directory
cedric-anne commented 3 years ago

Hi,

If the error did not blocked the patching process, the important part of the patch should have been applied correctly. Indeed, files mode is not a problem, and test file will not be usefull in your case. If files were not patched, you can try with patch -p1 < /tmp/8413.patch.

Regards

jcervantes-sipecom commented 3 years ago

Ok I did what you suggested:

patch -p1 < /tmp/8413.patch

patching file inc/calendar.class.php
patching file inc/calendar_holiday.class.php
Hunk #1 succeeded at 237 (offset 31 lines).
patching file inc/holiday.class.php
patching file tests/functionnal/Calendar_Holiday.php
can't find file to patch at input line 528
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|
|From 873b18e0cc8a07bf52275d505e6ada1aac5c48a6 Mon Sep 17 00:00:00 2001
|From: =?UTF-8?q?C=C3=A9dric=20Anne?= <cedric.anne@gmail.com>
|Date: Wed, 23 Sep 2020 09:50:25 +0200
|Subject: [PATCH 2/2] Revert tests update as cache should be invalidate on
| holiday addition
|
|---
| tests/functionnal/Calendar.php | 11 ++++-------
| 1 file changed, 4 insertions(+), 7 deletions(-)
|
|diff --git a/tests/functionnal/Calendar.php b/tests/functionnal/Calendar.php
|index 282f78cf64a..fee14e5e802 100644
|--- a/tests/functionnal/Calendar.php
|+++ b/tests/functionnal/Calendar.php
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored

What else do we need to try?

cedric-anne commented 3 years ago

Do you still have performances issues after applying this patch ?

cedric-anne commented 3 years ago

We made some improvement on master branch. Performances should be better in next major version.