aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_service.erl
AgeCommit message (Collapse)Author
2014-05-25Merge branch 'anders/diameter/watchdog_leak/OTP-11934' into maintAnders Svensson
* anders/diameter/watchdog_leak/OTP-11934: Simplify sending of 'close' to watchdog Fix watchdog table leak
2014-05-25Merge branch 'anders/diameter/request_leak/OTP-11893' into maintAnders Svensson
* anders/diameter/request_leak/OTP-11893: Fix leaking request table Add check that request table is empty to failover suite Comment fix
2014-05-20Simplify sending of 'close' to watchdogAnders Svensson
There's no need to send the message immediately if there's no transport configuration since that in itself means the service process will tell the watchdogs to die.
2014-05-20Fix watchdog table leakAnders Svensson
Commit ef5fddcb (diameter-1.4.1, R16B) caused the leak in the case of an accepting watchdog with restrict_connections = false. It (correctly) ensured the state remained at INITIAL but a subsequent 'close' message to terminate the process was ignored since the state was not DOWN. In fact, no 'close' was sent since there was no state transition or previous connection: the former triggers the message from diameter_service, the latter from diameter_watchdog. The message is now sent to self() from the watchdog itself. Send 'close' in the same way when multiple connections to the same peer are allowed, to avoid waiting for a watchdog timer expiry for the process to terminate in this case.
2014-05-18Fix leaking request tableAnders Svensson
A new connection writes the pid to the table diameter_request. The normal handling is that loss of a connection leads to a watchdog state change in the service process, which removes the entry, but this usually won't happen in the case of diameter:stop_service/1 since the service process is terminated without waiting for watchdog transitions. The request table should really be service-specific, so that the table is deleted when the service is stopped, which requires passing the table identifier into request processes and handling that the table may not exist. Just clear out the service-specific entries at service process termination for now.
2014-03-31Merge branch 'anders/diameter/pick_peer/OTP-11789'Anders Svensson
* anders/diameter/pick_peer/OTP-11789: Fix pick_peer case clause failure
2014-03-20Fix pick_peer case clause failureAnders Svensson
In the case of {call_mutates_state, true} configuration on the service in question, any peer selection that failed to select a peer resulted in a case clause failure in diameter_service:pick_peer/5, when the call to the service process returned false. This was noticed in the case of a peer failover in which an alternate peer wasn't available. The explicit matching is intentional, to match exactly what's expected.
2014-01-27Remove upgrade-related codeAnders Svensson
No longer needed to update code in runtime since the emulator is restarted at a major release.
2013-11-29Rename reconnect_timer -> connect_timerAnders Svensson
The former was misleading since the timer only applies to initial connection attempts, reconnection attempts being governed by watchdog_timer. The name is a historic remnant from a (dark, pre-OTP) time in which RFC 3539 was followed less slavishly than it is now, and the timer actually did apply to reconnection attempts. Note that connect_timer corresponds to RFC 6733 Tc, while watchdog_timer corresponds to RFC 3539 TwInit. The latter RFC makes clear that TwInit should apply to reconnection attempts. It's less clear if only RFC 6733 is read. Note also that reconnect_timer is still accepted for backwards compatibility. It would be possible to add an option to make reconnect_timer behave strictly as the name suggests (ie. ignore RFC 3539 and interpret RFC 6733 at face value; something that has some value for testing at least) but no such option is implemented in this commit.
2013-09-04Fix broken spawn_optAnders Svensson
The option was morphed into a boolean() and then ignored.
2013-06-10Make spawn options for request processes configurableAnders Svensson
That is, for the process that's spawned for each incoming Diameter request message.
2013-04-10Fix watchdog table leakAnders Svensson
A service process maintains a table keyed on watchdog process pids. When a watchdog process dies the corresponding entry should be removed but this was broken in commit f115a9f7, causing entries with watchdog state DOWN to accumulate. Watchdog processes die as a result of diameter:remove_transport/2, or when a peer reestablishes a connection in the listening case. Neither is typically a frequent occurrence. The fault manifests itself in the return value of diameter:service_info(SvcName, transport), which displays entries for watchdog processes that are no longer alive.
2013-03-19Merge branch 'maint-r16' into maintAnders Svensson
2013-03-17More flexible distribution configAnders Svensson
Allow both share_peers and use_shared_peers to be a list of nodes, or a function that returns a list of nodes.
2013-03-17Distribution fixesAnders Svensson
This is the functionality that allows transports to be shared between identically-named services on different nodes, which has been neither documented nor tested (until now).
2013-03-04Rework stats to avoid concurrent read and writeAnders Svensson
Counters read by diameter:service_info(SvcName, transport) can be selected at the same time as the diameter_stats server is folding them into another key, possibly resulting in inaccurate values. Have diameter_stats select from the server process to avoid this and add diameter_stats:sum/1 to sum values from all contributors on a given term.
2013-02-08Tweak service interface towards diameter_peerAnders Svensson
2013-02-08Split message handling in diameter_service into diameter_trafficAnders Svensson
Traffic handling is connected to the service implementation through the pick_peer callback and failover but diameter_service was getting unwieldy as home to both the service process and traffic handling.
2013-02-08Simplify request recordAnders Svensson
In particular, remove fields containing values that are known (as of the preceding commit) to the request process.
2013-02-08Move failover out of service processAnders Svensson
In order to be able to remove fields from the request process that don't need to be there and do less in the service process. The pick_peer callback now takes place in the request process in the case of immutable state, just as in the case of the initial send.
2013-02-08Don't hardcode common dictionaryAnders Svensson
Instead, use whatever dictionary a transport has configured as supporting application id 0. This is to support the updated RFC 6733 dictionaries (which bring with them updated records) and also to be able to transparently support any changed semantics (eg. 5xxx in answer-message).
2013-02-08Fix faulty watchdog transition DOWN -> INITIALAnders Svensson
This was the result of the watchdog process exiting as a consequence of peer death in some casesi, causing a restarted transport to enter INITIAL when it should enter REOPEN. The watchdog now remains alive as long as peer shutdown isn't requested and a 'close' message to the service process (instead of watchdog death) generates 'closed' events from the service.
2013-02-08Comment fixesAnders Svensson
2013-02-08Rename records peer/conn -> watchdog/peer in diameter_serviceAnders Svensson
That is, make the naming match that of the corresponding modules. This has long been fairly confusing.
2013-02-08Simplify watchdog transitions in service processAnders Svensson
In particular, use watchdog messages as input and do away with the older connection_up/down (and other) messages. Also, only maintain the watchdog state, not the older up/down op state.
2013-02-08Simplify transport shutdownAnders Svensson
Service process informs the watchdog process which informs the peer process. (Instead of going directly to the latter in one case.)
2013-02-08Remove upgrade code not needed after application restartAnders Svensson
Which will be the case with R16B in this case.
2013-01-23Remove upgrade code not needed at a major releaseAnders Svensson
2013-01-23Comment fixAnders Svensson
2013-01-18Ensure correct setting of 3xxx result codeAnders Svensson
A bad AVP Length (resulting in excess bytes from decode) but no other errors caused the request to fail when attempting to set Result-Code. A protocol error in combination with a 5xxx error caused the latter to be set in an answer-message.
2013-01-17Merge branch 'maint-r15'Anders Svensson
2013-01-17Merge branch 'anders/diameter/start_event/OTP-10618'Anders Svensson
* anders/diameter/start_event/OTP-10618: Fix timing of service start event
2013-01-17Merge branch 'anders/diameter/packet_return/OTP-10614'Anders Svensson
* anders/diameter/packet_return/OTP-10614: Add missing error handling clause for handle_request packet return
2013-01-17Merge branch 'anders/diameter/make_packet/OTP-10609'Anders Svensson
* anders/diameter/make_packet/OTP-10609: Fix diameter_service:make_prepare_header/2
2013-01-15Fix diameter_service:make_prepare_header/2Anders Svensson
Fault caused the header of a [#diameter_header{} | Avps] request to be ignored if both end_to_end_id and hop_by_hop_id were undefined. Broken in commit bc87eb33.
2013-01-14Reverse swapped argumentsAnders Svensson
The fault caused a handle_request callback to fail whenever an eval tuple was returned. Introduced in commit f24adb28.
2012-12-10Fix setting of T flag at failoverAnders Svensson
This seems to have been broken at some point before diameter was included in OTP, prior to R14B03.
2012-12-06Fix timing of service start eventAnders Svensson
Whether or not it came first was a matter of timing. Originally bungled in commit 476db530.
2012-12-04Add missing error handling clause for handle_request packet returnAnders Svensson
This should have been included in commit 91a223d3.
2012-11-19Dialyzer fixAnders Svensson
The removed clause was added in commit c14ef2db as part of an aborted implementation.
2012-11-18Merge branch 'anders/diameter/transport_data/OTP-10566' into maintAnders Svensson
* anders/diameter/transport_data/OTP-10566: Add a testcase Allow a handle_request callback to return a #diameter_packet{}
2012-11-18Merge branch 'anders/diameter/transport_shutdown/OTP-10493' into maintAnders Svensson
* anders/diameter/transport_shutdown/OTP-10493: Add simple DPR suite Correct diameter:remove_transport/2 doc Fix broken doc link Ensure watchdog dies with transport if DPR was sent Remove dead clause Implement transport_opt() disconnect_cb Document transport_opt() disconnect_cb
2012-11-16Add start/stop service_event()Anders Svensson
2012-11-15Allow a handle_request callback to return a #diameter_packet{}Anders Svensson
This allows it to set transport_data and header, inappropriately so even.
2012-11-15Implement transport_opt() disconnect_cbAnders Svensson
2012-11-05Add service_info for a peer_ref()Anders Svensson
This allows a diameter_app callback to retrieve the corresponding configuration as passed to diameter:add_transport/2.
2012-11-05Implement service_opt() restrict_connectionsAnders Svensson
2012-11-05Update/clarify some commentsAnders Svensson
2012-11-05Add reopen message from watchdogAnders Svensson
This makes capabilities available to service_info as soon as capabilities exchange has been completed. In particular, before state OKAY is reached.
2012-11-05Add options service_infoAnders Svensson
To retrieve service_opt() values. Don't document it yet.