Wrong Closest-hit Point in Raytracing for multiple objects

I created two objects in Optix, a concave spherical surface and a cylindrical surface. The rays are designed to hit concave spherical surface first and then refracted to the cylindrical surface. The ray would stop on the cylindrical surface.

I traced a ray and printed where the ray hit:
Origin:(-0.000003,30.000000,0.000000) Direction:(0.202221,-0.979340,-0.000558)
SphericalSurface From (-0.0000,30.0000,0.0000) To(6.0041,0.9227,-0.0166)
CylindricalSurface From (6.0041,0.9227,-0.0166) To(9.9998,-15.5348,-0.0276)

The ray starts from(0,30,0),hits the spherical surface at (6.0041,0.9227,-0.0166), and then stops at (9.9998,-15.5348,-0.0276) on cylindrical surface. Everything goes as planned before.

However, when I leave the spherical surface unchanged, but translate the cylindrical surface along the y-axis for about 0.2f. The ray goes like this:

Origin:(-0.000003,30.000000,0.000000) Direction:(-0.202971,-0.979184,-0.001124)
CylindricalSurface From (-0.0000,30.0000,0.0000) To(-9.9995,-18.2402,-0.0554)

The ray missed spherical surface and go straight to the cylindrical surface.
I didn’t change the position of spherical surface here. There is no doubt that Point(6.0041,0.9227,-0.0166) is much closer to the Origin than Point(-9.9995,-18.2402,-0.0554).
The boundingbox program and intersection program are copied from optixIntro in Optix-Advanced-Samples. The objects are separately created from geometry to geometrygroup. Different materials are attached to the geometryInstance.Finally geometrygroups are added to the group as a child.

Is there any clue about what happpened here? Thanks a lot!

PS:Win10, GTX1050, DriverVersion 398.36, OptiX version 5.1.0, CUDA toolkit version 9.0.

I feel sorry for examining the program carelessly.

it = m_mapOfPrograms.find("AbsorbClosesthit");
		MY_ASSERT(it != m_mapOfPrograms.end());
		m_absorbMaterial->setClosestHitProgram(0, it->second);

		it = m_mapOfPrograms.find("AbsorbAnyhit");
		MY_ASSERT(it != m_mapOfPrograms.end());
		m_absorbMaterial->setAnyHitProgram(0, it->second);

Look, the ray_type_index here for AnyHitProgram is 0. I should have set it to 1.

RT_PROGRAM void AbsorbAnyhit()
	thePrdShadow.visible = false;

Optix would invoke any-hit program first for each ray_type to find all possible intersections. Thus radiance ray(ray_type_index =0) tracing stops when intersection on cylindrical surface is found. Closest-hit program won’t be called here.