Why I got a bad result image background shadow?
It appears that the problem is due to the Alpha Threshold of the Render Layer affecting the Object Index.

The Alpha Threshold controls whether transparent objects in the scene register on certain passes of the render layer. 

Anything greater than or equal to the Alpha Threshold will be included in that pass, anything less than the threshold will not. In your example scene the Alpha Threshold is set to 0.5 and this results in the Object Index pass from not being consistently present. By reducing the threshold (ie, to 0.2 in the screenshot below), the Object Index is included correctly and the compositor is able to process the index correctly.