[#856] Invalid request getStartTimeMatrix

Migrated from Redmine #856 | Author: Timur Mukhatov
Status: Feedback | Priority: Immediate, there is BUG! | Created: 2022-03-25


Hello,

We are experiencing an error during RPC call to getStartTimeMatrix method. The response error message is “Invalid request”. The strange thing is that sometimes the same request fails and sometimes not. This issue is causing a huge business impact.

Here is the HTTP request details:

Headers:
Content-type: application/json
X-Company-Login: sunshinesmilede
X-User-Token: hidden

Body:
{“method”:“getStartTimeMatrix”,“params”:[“2022-03-25 15:16:42”,“2022-04-24 15:16:42”,17,“237”,1],“id”:1}

We tried to send datetime without seconds, eg. 2022-03-25 15:16, but it didn’t help.

Could you have a look, please?

Redmine Admin wrote:

hi, all times must be multiple of timeframe. E.g. if timeframe is 15 minutes then 15:16:12 is not allowed and must be replaced by 15:15:00. You need to provide time in hh:mm:ss format but this time must be multiple of your timeframe

Timur Mukhatov wrote:

Thank you, we will try this solution

Timur Mukhatov wrote:

Hello, could you clarify regarding timeframe. Do you mean the service duration?

Redmine Admin wrote:

hi, no. Timeframe is a tiframe. You have a settings for it under Settings ->Configuration: timeframe. It is usally 5-10-15-20-30-60 minutes

Timur Mukhatov wrote:

Got it now, thank you

Timur Mukhatov wrote:

Unfortunately, the solution with timeframe didn’t help. Here is an example of a request that failed:

{“method”:“getStartTimeMatrix”,“params”:[“2022-03-30 06:10:00”,“2022-04-29 06:10:00”,17,705,1],“id”:1}

Do you have other ideas why it can be failing? I attached a screenshot with an overview of failed events. We can see that sometimes they fail and sometimes not. In the period between 3:16 and 6:11 there were no failed requests and after 6:11 requests from qa04 and qa05 machines failed. Maybe this information will help to investigate.

Redmine Admin wrote:

you should never call period longer then one week, here is 2 monthes call

Timur Mukhatov wrote:

Unfortunately, this solution also didn’t work. This is an example of request that failed with “Invalid request getStartTimeMatrix” error:

{“method”:“getStartTimeMatrix”,“params”:[“2022-04-03 23:10:00”,“2022-04-10 23:10:00”,1,61,1],“id”:1}

Dmytro Bondarev wrote:

Hi, you should pass only date, not datetime in request.
If you have any issues please provide raw HTTP request and response.

Timur Mukhatov wrote:

Hello again, this solution also didn’t work out.

Please pay attention that we get this kind of response for other requests. And sometimes they happen and sometimes not. Here is the raw request and response examples:

getBookings request:


{"http":{"method":"POST","timeout":60,"header":"Content-type: application\/json\r\nX-Company-Login: sunshinesmilenlstaging\r\nX-User-Token: *hidden*\r\n","content":"{\"method\":\"getBookings\",\"params\":[{\"date_from\":\"2022-04-06 16:05:00\",\"date_to\":\"2022-05-06 16:05:00\",\"unit_group_id\":89,\"booking_type\":\"non_cancelled\"}],\"id\":7}"}}

getBookings response:


{"error":{"code":-32600,"message":"Invalid request","data":[]},"id":"7"}

getCompanyParams request:


{"http":{"method":"POST","timeout":60,"header":"Content-type: application\/json\r\nX-Company-Login: sunshinesmilenlstaging\r\nX-User-Token: 4bb7d70fd870c96226fea20d990b4beeba4f6d83c5047e584ec69f638ba2dc9a\r\n","content":"{\"method\":\"getCompanyParams\",\"params\":[[\"max_time_till_event\",\"timeframe\"]],\"id\":1}"}}

getCompanyParams response:


{"error":{"code":-32600,"message":"Invalid request","data":[]},"id":"1"}

getStartTimeMatrix request:


{"http":{"method":"POST","timeout":60,"header":"Content-type: application\/json\r\nX-Company-Login: sunshinesmilestaging\r\nX-User-Token: 1b0f03b490a52fd3e1cea1033f1f8bdbe68bea725bb36ee581517c0b72378926\r\n","content":"{\"method\":\"getStartTimeMatrix\",\"params\":[\"2022-04-06\",\"2022-04-13\",1,31,1],\"id\":1}"}}

getStartTimeMatrix response:


{"error":{"code":-32600,"message":"Invalid request","data":[]},"id":"1"}

Dmytro Bondarev wrote:

Hi,
How often you have such issue?

Timur Mukhatov wrote:

In the last 24 hours it happened 65 times and in the last 30 days 1800 times. I attached a screenshot with a timeline visualizing the distribution.

For the context: we have a cronjob running every 15 minutes that calls getBookings, getStartTimeMatrix and other methods for every service provider and service for all company accounts.

Timur Mukhatov wrote:

Hello, are there any updates?

Dmytro Bondarev wrote:

Hi, as far as i see you are making a lot of API calls.
And as i see you are create new token for each call. You should reuse token and make new one only if old token expired.
Also as i see you a on dedicated server. You should decrease count of concurrency requests or increase server power. (you can contact to your sales manager)

Timur Mukhatov wrote:

Thank you, we will try both options and I will let you know if it worked