[sr-dev] [kamailio/kamailio] Calling jsonrpc_notification fail in failure route when fr_timer timeout (#713)

Ian Yu-Hsun Lin notifications at github.com
Sat Jul 16 11:08:16 CEST 2016


## Environment

Kamailio 4.3.3
Ubuntu 14.04.1 x86_64

## Problem

I'm using `t_suspend()` and `t_continue()` for mobile push notification scenario. Before calling `t_suspend()` I set the `fr_timer` to 12 seconds and `t_on_failure()` to my custom failure route (e.g. `failure_route[MY_FAILURE_ROUTE]`). The scenario is fairly similar to [[SR-Users] Timeout after t_suspend and failure route][1], the only difference is I try to use `jsonrpc_notificaion()` to notify the user asynchronously in my custom failure route.

There are 2 different results depending on how it goes to the failure route:

1. Caller cancel the call before `fr_timer` expires
  - `jsonrpc_notification` can successfully be called in failure route
2. The `fr_timer` did timeout after 12 seconds
  - An error occurred while calling `jsonrpc_notification`:
  - `jsonrpc_notification(): failed to write to io pipe: Bad file descriptor`

## Investigation

For the first case that perform normally, the IDs of Kamailio processes being used are the same for both **calling t_suspend()** and **entering failure route**, while in the second case the processes are different.

Following added some debug messages in Kamailio's `main.c` it showed that the process being used in the failure route of case 2 is `slow timer process`, and from `jsonrpc_mod.c`'s `child_init()` function, the rank of `slow timer process` is **-1** therefore it doesn't assign the `fd` to this process.

My workaround was just assigning the `fd` to each child during `child_init()` in `jsonrpc_mod.c` but that's definitely not a good way to go. I am appreciated if you can give me some advice to solve this problem correctly.

Cheers,
Ian


[1]: http://lists.sip-router.org/pipermail/sr-users/2015-March/087519.html

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/713
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160716/ccc77403/attachment-0001.html>


More information about the sr-dev mailing list