Some confusion on AnyHit shader in OptiX

Hello, currently I’m learning OptiX. I’m using OptiX 7.5. Now I’m trying to setup a very simple scene with ray origin locating at (0, 0, -1), N spheres locating at (0, 0, 1), (0, 0, 2), …, (0, 0, N), and I’m shooting ray from the origin to (0, 0, 1) direction with tmax=1e16, as following figure:

I expect the anyhit shader to report 2*N hit record (1 for front and 1 for back), while it only report 1 hit record (the front surface of the first sphere). Following is my raygen shader:

extern "C" __global__ void __raygen__rg() {
    const uint3 idx = optixGetLaunchIndex();
    const uint3 dim = optixGetLaunchDimensions();
    const float3 origin = make_float3(0.0f, 0.0f, 0.0f);
    const float3 direction = make_float3(0.0f, 0.0f, 1.0f);
    // printf("Ray:%d Generated, Origin:(%f,%f,%f)\n", idx.x, origin.x, origin.y, origin.z);
    optixTrace(params.handle, 
               origin, 
               direction, 
               0.0f, 
               1e16f, 
               0.0f, 
               OptixVisibilityMask(1), 
               OPTIX_RAY_FLAG_NONE, 
               0, 
               0, 
               0
              );
}

I also tried to recursively invoke optixTrace in closest_hit shader, while the parameter max_traverse_depth limit the max hit record I can generate. Moreover, according to my understand, the ray tracing will find all primitives that intersect with a ray in a single ray casting, am I right?

The problem is: How can I generate all expected hit record in this pipeline?
Thanks.