A weird bug saying segmentation fault when rendering images using get_camera_images

I’m trying to render images in my simulation environment, self.env is the isaacgym environment and self.render_camera = self.env.gym.create_camera_sensor(self.env.envs[0], camera_props). Here is what I have done to render frames:

self.env.gym.step_graphics(self.env.sim)
self.env.gym.render_all_camera_sensors(self.env.sim)
img = self.env.gym.get_camera_image(self.env.sim, self.env.envs[0], self.rendering_camera, gymapi.IMAGE_COLOR)

I got Segmentation fault (core dumped) when running gym.get_camera_image the third time, but there is no such problem if I simply get the image twice:

self.env.gym.step_graphics(self.env.sim)
self.env.gym.render_all_camera_sensors(self.env.sim)
img = self.env.gym.get_camera_image(self.env.sim, self.env.envs[0], self.rendering_camera, gymapi.IMAGE_COLOR)
img = self.env.gym.get_camera_image(self.env.sim, self.env.envs[0], self.rendering_camera, gymapi.IMAGE_COLOR)

I felt extremely confused, please let me know if I have done something wrong. I’m also curious about the reason for this problem.