Caps for shadow volumes

I try create shadows, using shadow volumes in my engine and I use zfail method with caps.
This work good, but i have problems with caps for shadow volume.

If geometry have open edges (such as teapot in 3d max where lid is opened),
then stencil buffer give visual artifacts.

I create its geometry in 3d max and not always geometry will be with
closed edges for example walls or other static objects.

Also geometry as I understand can’t be optimized by frustum culling, or octree for example.
Result will be incorrect for shadow volumes because geometry will have open edges.

Possible solve this problems? And as she solves? Can You show it in simple code?

Please help me.