Let M be compact Riemann manifold with boundary.
The unit sphere bundle $SM$ is given by $$SM=\{(x, v)||v|_{g}=1,x \in M\}$$ where $g$ is the Riemannian metric in the tangent space at $x$.
Given $(x, v) \in S M$, let $\gamma_{x, v}$ denote the unique geodesic determined by $(x, v)$ so that $\gamma_{x, v}(0)=x$ and $\dot{\gamma}_{x, v}(0)=v$. For any $(x, v) \in S M$ the geodesic $\gamma_{x, v}$ is defined on a maximal interval of existence that we denote by $\left[-\tau_{-}(x, v), \tau_{+}(x, v)\right]$ where $\tau_{\pm}(x, v) \in[0, \infty]$, so that $$ \gamma_{x, v}:\left[-\tau_{-}(x, v), \tau_{+}(x, v)\right] \rightarrow M $$ is a smooth curve that cannot be extended to any larger interval as a smooth curve in $M$.
We let $$ \tau(x, v):=\tau_{+}(x, v) $$ Thus $\tau(x, v)$ is the exit time when the geodesic $\gamma_{x, v}$ exits $M$.
I am interested in finding an example of manifold such that there exists geodesic at point $x$ and direction $v$ such that first time geodesic to hit the boundary is different from exit time of geodesic $\tau_{(x,v)}$.
I could not imagine an example where geodesic reach boundary but come back again inside the manifold.
Any help or hint will be appreciated.
Consider a sphere with a small open disk removed.
Then it is a manifold with boundary, the boundary being a circle. Consider a geodesic starting from a point on this circle and going tangentially to the circle boundary.
Then this geodesic is defined on $\mathbb{R}$ but hits the boundary periodically.
The degenerate case is when the boudary circle is a great circle: in this case, the boundary is totally geodesic, and the geodesic constructed above stays forever in the boundary while being defined for all time.
Another example, this time with a finite exit time:
This is a flat torus with a little open disk removed.