I have just updated from osticket 1.9 to 1.14.2.

All seemed to went fine with the update but now I can't answer tickets unless I change "Collision Avoidance Duration" to zero.

I have checked the timezone from terminal: Sat May 9 23:35:22 WEST 2020
MySQL:

NOW() | CURDATE() | CURTIME()
2020-05-09 23:35:58 | 2020-05-09 | 23:35:58

And in osTicket: tried both Europe / london and europe / lisbon

This was working without issues in 1.9 with the locks.

osTicket is installed in a cpanel account in a centos 7 server.

The only changes made was the PHP version changed from 5.6 to 7.3.

What is wrong here?

I do not see an issue here... If you have collision avoidance on and the ticket is locked you will have to wait for the lock to expire before someone else can update a ticket. That's sort of the point o the feature.

The issue is that there is no other user logged in.

I made the update yesterday, I was the only person logged in, I created a new ticket, accessed it, and couldn't respond.

Email dates in the ticket appear one hour before. UTC / GMT instead of GMT+1. Not sure if that was the issue, but before the update everything worked ok.

Then that would be the problem. You have a timezone issue somewhere and the locks are expriring as (before) they are being made. I recommend that you search the forums for some of the other threads that have issues and find a reply by the dev KEvin who has given detailed instructions on all the different places that you need to make sure that your timezones are correct.

In short they are: the mysql db, php, osticket.

Well if you had read my original post, than you'd understand I already did that.

As you've seen in my original post, all timezones are set to Europe/Lisbon.

I did not put the time from PHP, but here it is:

php > echo date("Y-m-d H:i:s");
2020-05-10 23:15:50
php > exit
[user@host Site]$ date
Sun May 10 23:19:08 WEST 2020

I am not sure what is missing, I might be missing something, but without further details from osticket, it's hard to guess where.

@alfasoft

The This action requires a lock. Please try again! warning means that either your system cannot create a Lock when it's required OR there is a time discrepancy. So we first need to find out if your system is actually creating locks. First you need to go to the database and delete any ost_lock records with staff_id matching your Staff account's ID (this will ensure a clean slate for us to start from). Next you will go to a ticket and start typing a Reply (this should trigger the lock mechanism and create a lock). Now we can check the ost_lock table again to see if there is a new lock being created with your staff_id (be sure to refresh the table contents). If so then it has to be a time discrepancy.

You see, when we create/renew locks, the lock expiration is created via SQL functions so it will be in the database timezone. When we check if the Lock is expired we check the current time via Misc::dbtime() method against the lock expiration time (in db timezone). The Misc::dbtime() method generates a date/time string based on PHP's timezone, generates a date/time string based on the database timezone, then adds the database offset to the PHP timezone (which should make it equivalent to the current time in the db timezone).

With this being said you can try var_dump(); in the Misc::dbtime() method (link here) and Lock::isExpired() method (link here) to see where it's going wrong.

Cheers.

    24 days later

    KevinTheJedi
    the ost_lockl show me the lock when i try to edit a ticket, the time set in the record is correct ... but i can't add a response, everytime the "This action requires a lock. Please try again" show ...

    @Cervedgroup

    I would first put var_dump($lock->isExpired()); in function getLock() {} in include/class.ticket.php (found here) to see if the lock is "expired". If so, then there is definitely a time discrepancy.

    Cheers.

    3 years later

    if you see this error "This action requires a lock. Please try again"
    you just need to make one quick setting. Set "Collision Avoidance Duration" to 0. This will override setting.

    Write a Reply...