SOME/IP in AUTOSAR Classic

SOME/IP

FindService

A client that needs a service instance and knows no valid OfferService for it asks for it with a FindService (the question "who offers this service?"), a few times with growing gaps, and then simply listens. Any OfferService ends the asking at once.

Listening comes first

A client listens to every OfferService all the time, even before it needs the service, and Sd remembers which service instances are available and for how long (their TTL). When BswM sets the client service to REQUESTED (wanted; RELEASED means not wanted) and a valid offer is already known, there is nothing to ask: the client goes straight to using it.

The client phases

Only when no valid offer is known does the client send a FindService (an SD entry from the client: "who offers this service?"). It goes through the same three phases as the server, with one big difference: a FindService is never repeated forever.

Timing diagram: the client service is RELEASED until 1 second, the Initial Wait Phase lasts until 1.5 seconds, FindService goes out at 1.5, 2, 3 and 5 seconds with doubling gaps, then the client only listens in the Main Phase. The server becomes available later and sends OfferService at 6.6 seconds; from then on the client service is AVAILABLE. RELEASED client phase Repetition Phase Main Phase: listen only Initial Wait Phase FindService OfferService server starts client service AVAILABLE 0 s12 s
Figure 1. Squares are FindService entries, circles are OfferService entries. The four FindService entries all go unanswered because the server is not up yet; after the last one the client only listens. The server's very first OfferService is enough to make the client service AVAILABLE (Sd reports to BswM: the service has been offered).

phase 1

Initial Wait Phase

A random wait between INITIAL_DELAY_MIN and INITIAL_DELAY_MAX. If an OfferService arrives meanwhile, the client takes it and sends no FindService.

phase 2

Repetition Phase

A FindService, then another after REPETITIONS_BASE_DELAY, twice that, four times that, REPETITIONS_MAX times.

phase 3

Main Phase

No more FindService. The client waits for the OfferService entries the server sends in its own Main Phase.

Any OfferService for the wanted service instance, in any phase, stops the FindService entries and moves the client to the Main Phase.

What a FindService says

A FindService names the Service ID and, if the client cares, the Instance ID, major version and minor version; each of these may also be "any" (Instance ID 0xFFFF, major version 0xFF, minor version 0xFFFFFFFF). It carries no Endpoint option: the server answers to the address the FindService came from. A FindService carries a TTL too; after it runs out, the FindService counts as forgotten.

Answering a multicast message

A FindService by multicast can reach many servers at the same moment, and an OfferService by multicast can make many clients send a SubscribeEventgroup (the client's request for the events of an eventgroup, lesson 14) at the same moment. To avoid a storm of answers, an answer to a message received by multicast waits REQUEST_RESPONSE_DELAY first. Answers to unicast messages go out without this delay.

When the service instance disappears

TTL runs out

FindService again

Sd reports the client service as DOWN (no longer offered) and starts over with the Initial Wait Phase, so it sends FindService again.

StopOfferService

Wait quietly

The server ended the offer on purpose with a StopOfferService. Sd reports the client service as DOWN but sends no FindService; it waits for the next OfferService.

Try it

Pick who starts first and press "Start". Both sides use the same settings: Initial Wait Phase about 0.5 s, REPETITIONS_BASE_DELAY 0.5 s, REPETITIONS_MAX 3; the server's CYCLIC_OFFER_DELAY is 3 s.

Things to notice. "Server first": the client never sends a single FindService. "Client first": every FindService is wasted, and later the server's own OfferService does the job. "Server never comes": after the Repetition Phase the network stays quiet; no FindService is sent forever.

Check yourself optional

New terms in this lesson

TermMeaning
FindServiceClient: "who offers this service?"; sent by multicast in the Initial Wait and Repetition Phase only
REQUESTED / RELEASEDSet by BswM: the client service is wanted / not wanted

Source: SOME/IP-SD Protocol Specification, R20-11, sections 4.1.2.5 (find), 4.1.4.1 and 4.1.4.2; Service Discovery, R20-11, sections 7.5.3.1 and 7.7.