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

[ 9.1.6 ] Concurrency modification on a ticket cause status to regress #3578

Closed sdicioccio81 closed 6 years ago

sdicioccio81 commented 6 years ago

0-GLPI version 9.1.6 , choose a ticket initially on "assigned" status 1- On an assigned assistance ticket one user start to write a follow up but DO NOT submit at thit time 2- On the same assistance ticket another user DO plan a task => status of the ticket is now 'planned' 3- The first user that was writing the follow up (in step 1) DO submit it just now

We can see some strange behavious in SQL logs

1st update (task) done by DI CIOCCIO Stéphane - Step 2 we see that task is created and ticket status updated to '3' (planned)

INSERT INTO glpi_tickettasks (content,tickets_id,taskcategories_id,state,is_private,actiontime,users_id_tech,groups_id_tech,begin,end,users_id,date,date_creation,date_mod) VALUES ('ajout tache ','2017002205','3','1','0','3600','11','0','2018-02-19 13:45','2018-02-19 14:45:00','11','2018-02-19 13:40:22','2018-02-19 13:40:22','2018-02-19 13:40:22') UPDATE glpi_tickets SET date_mod = '2018-02-19 13:40:22', users_id_lastupdater = '11' WHERE id = '2017002205' UPDATE glpi_tickets SET actiontime = '7200' WHERE id = '2017002205' => UPDATE glpi_tickets SET status = '3' WHERE id ='2017002205' UPDATE glpi_tickets SET date_mod = '2018-02-19 13:40:22' WHERE id ='2017002205' INSERT INTO glpi_logs (items_id, itemtype, itemtype_link, linked_action, user_name, date_mod, id_search_option, old_value, new_value) VALUES ('2017002205', 'Ticket', '', '0', 'DI CIOCCIO Stephane (11) (11)', '2018-02-19 13:40:22', '12', '2', '3') INSERT INTO glpi_logs (items_id, itemtype, itemtype_link, linked_action, user_name, date_mod, id_search_option, old_value, new_value) VALUES ('2017002205', 'Ticket', 'TicketTask', '17','DI CIOCCIO Stephane (11) (11)', '2018-02-19 13:40:22', '0','', '10938') INSERT INTO glpi_events (items_id,type,date,service,level,message) VALUES ('2017002205','ticket','2018-02-19 13:40:22','tracking','4','stephane_di_cioccio ajoute une tâche')

2nd update (followup) done by Manuel MAINDRON - Step 3 we see that the follow up do modify back to status '2' (assigned')

INSERT INTO glpi_ticketfollowups (content,tickets_id,requesttypes_id,is_private,users_id,date,date_creation,date_mod) VALUES ('TEST BUG TEST BUG','2017002205','0','0','12','2018-02-19 13:40:40','2018-02-19 13:40:40','2018-02-19 13:40:40') UPDATE glpi_tickets SET date_mod = '2018-02-19 13:40:40', users_id_lastupdater = '12' WHERE id = '2017002205' => UPDATE glpi_tickets SET status = '2' WHERE id ='2017002205' UPDATE glpi_tickets SET date_mod = '2018-02-19 13:40:40' WHERE id ='2017002205' INSERT INTO glpi_logs (items_id, itemtype, itemtype_link, linked_action, user_name, date_mod, id_search_option, old_value, new_value) VALUES ('2017002205', 'Ticket', '', '0', 'MAINDRON Manuel (12) (12)', '2018-02-19 13:40:40', '12','3', '2') INSERT INTO glpi_logs(items_id, itemtype, itemtype_link, linked_action, user_name, date_mod, id_search_option, old_value, new_value) VALUES ('2017002205', 'Ticket', 'TicketFollowup', '17', 'MAINDRON Manuel (12) (12)', '2018-02-19 13:40:40', '0','', '96660') INSERT INTO glpi_events (items_id,type,date,service,level,message) VALUES ('2017002205','ticket','2018-02-19 13:40:40','tracking','4','manuel_maindron ajoute un suivi')

[code]   GLPI 9.1.6 ( => /data/glpi/glpi-916/glpi)

Operating system: Linux GLP-PREP-AMP01 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Dec 28 14:23:39 EST 2017 x86_64 PHP 7.1.8 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apcu, bcmath, bz2, calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_sqlite, posix, session, shmop, snmp, sockets, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zip, zlib) Setup: max_execution_time="300" memory_limit="128M" post_max_size="2M" safe_mode="" session.save_handler="files" upload_max_filesize="15M" Software: Apache () Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 Server Software: MySQL Community Server (GPL) Server Version: 5.6.37-log Server SQL Mode: Parameters: glpi@127.0.0.1/glpi_916 Host info: 127.0.0.1 via TCP/IP /data/glpi/glpi-916/glpi/config : OK /data/glpi/glpi-916/glpi/files : OK /data/glpi/glpi-916/glpi/files/_dumps : OK /data/glpi/glpi-916/glpi/files/_sessions : OK /data/glpi/glpi-916/glpi/files/_cron : OK /data/glpi/glpi-916/glpi/files/_graphs : OK /data/glpi/glpi-916/glpi/files/_lock : OK /data/glpi/glpi-916/glpi/files/_plugins : OK /data/glpi/glpi-916/glpi/files/_tmp : OK /data/glpi/glpi-916/glpi/files/_rss : OK /data/glpi/glpi-916/glpi/files/_uploads : OK /data/glpi/glpi-916/glpi/files/_pictures : OK /data/glpi/glpi-916/glpi/files/_log : OK SELinux mode is Enforcing SELinux boolean configuration for httpd_can_network_connect --> on SELinux boolean configuration for httpd_can_network_connect_db --> on SELinux boolean configuration for httpd_can_sendmail --> on

htmLawed version 1.1.21 in (/data/glpi/glpi-916/glpi/lib/htmlawed) phpCas version 1.3.5 in (/data/glpi/glpi-916/glpi/vendor/jasig/phpcas/source) PHPMailer version 5.2.23 in (/data/glpi/glpi-916/glpi/vendor/phpmailer/phpmailer) Zend Framework in (/data/glpi/glpi-916/glpi/vendor/zendframework/zend-loader/src) zetacomponents/graph in (/data/glpi/glpi-916/glpi/vendor/zetacomponents/graph/src) SimplePie version 1.5 in (/data/glpi/glpi-916/glpi/vendor/simplepie/simplepie/library) TCPDF version 6.2.12 in (/data/glpi/glpi-916/glpi/vendor/tecnickcom/tcpdf) michelf/php-markdown in (/data/glpi/glpi-916/glpi/vendor/michelf/php-markdown/Michelf) true/punycode in (/data/glpi/glpi-916/glpi/vendor/true/punycode/src) iacaml/autolink in (/data/glpi/glpi-916/glpi/vendor/iamcal/lib_autolink) sabre/vobject in (/data/glpi/glpi-916/glpi/vendor/sabre/vobject/lib)

Server: '10.49.64.25', Port: '389', BaseDN: 'dc=carrefour,dc=com', Connection filter: none, RootDN: 'uid=readldap_redmine,ou=people,dc=corp,dc=carrefour,dc=com', Use TLS: none

Not active

Way of sending emails: SMTP (anonymous@smtp.services.hdf)

 

fields Name: Champs supplémentaires Version: 1.6.2 State: Not installed behaviors Name: Comportements Version: 1.5.0 State: Enabled tag Name: Gestion des tags Version: 2.0.1 State: Enabled mod Name: GLPI Modifications Version: 1.1.2 State: Enabled renamer Name: Renamer Version: State: To be cleaned dashboard Name: Tableau de bord Version: 0.8.6 State: Enabled ticketlink Name: Ticketlink Version: 1.0.21 State: To be cleaned

tomolimo commented 6 years ago

Hello, You should use the lock mechanism to prevent such issues, see: image regards, Tomolimo

sdicioccio81 commented 6 years ago

Thanks tomolino !

Doing that I encounter another error that is explained right here : http://forum.glpi-project.org/viewtopic.php?id=156940

Undefined index : interface in glpi\inc\profile\profile.class.php on line 379 and causing then the Profile to be used when locking items not loading

Following the described procedure in the link above does resolve it

Regards

tomolimo commented 6 years ago

For this: I'm sorry I can't help as I don't have any idea about this error message.

sdicioccio81 commented 6 years ago

Thanks tomolino I resolved myself with the mentionned link in my previous post , it consist to comment the following lines in /glpi/inc/profile.class.php:

  if ($this->fields["interface"] == "helpdesk") {
     foreach ($this->fields as $key=>$val) {
        if (!in_array($key,self::$common_fields)
            && !in_array($key,self::$helpdesk_rights)) {
           unset($this->fields[$key]);
        }
     }
  }
trasher commented 6 years ago

This is not a good idea to comment those lines; you will open other issues elsewhere and will not be able to understand what is wrong...

trasher commented 6 years ago

Original issue seems to be fixed; closing

sdicioccio81 commented 6 years ago

Hello trasher,

However my first concern is why a simple follow up DO modify the status of a ticket, but however with what is described above I solved my issues

Thanks you

tomolimo commented 6 years ago

Hello @sdicioccio81 Regarding what you mentioned, the

No timeout

It is existing in the form of a cron job called: unlockobject

image

The timeout is hour based, and is unlocking objects locked for more than the setting, and not all objects like you do with the TRUNCATE TABLE.

regards, Tomolimo