mathutils.geometry.intersect_ray_tri() I have a problem. I use the intersect_ray_tri() function to find the intersection between a ray and a mesh. Somethimes it works perfectly fine and somethimes it only finds one of the two intersecton or none of the intersections. It seems like the problem has something do do with the angle it hits the mesh. I'm not sure if it is a bug or not. I really appreciate all your help.

http://pasteall.org/blend/index.php?id=44571
Open the .blend. You see a sphere emtpy. This defines the direction whichin the ray goes with the camera origin as a base point. When jumping one frame forwards/backward the script gets executed. If it finds an intersection it will add an empty to the location of the intersection(this is just for debugging now). Try do move the empty(make sure it stays behind on of the two meshes, as othervise it's clear it will not find an intersection) and you will see somethimes it finds both, somethimes just one one somethimes none of the intersections.
I'd say it's this bit

    dir = camera.location - pointer.location
    intersections = []

    for face in bm.faces:
        verts = []
        #print(face.index)
        for vert in face.verts:

            loc = obj.matrix_world * vert.co
            verts.append(loc)

        dir.negate()
        found = geometry.intersect_ray_tri(verts[0], verts[1], verts[2], dir, camera.location, True)
        intersections.append(found)


dir.negate() is being called for each face, effectively flipping the the ray on each iteration, giving a 50% chance of hitting the tri when it is in camera to pointer ray path.

Suggest setting 

dir = (pointer.location - camera.location).normalized()


in the first place, and removing dir.negate().