I later found that not only modulo Sophie Germain primes lead to a hang
but generally any argument whose order has large prime factors.
Currently I am avoiding the hangs by the following escape (and it works)
Sieve before escape (hangs around p ~ 2^28 and later around 2^29 if escaped with "if(isprime(p\2),next);")
forprime(p=19,2^28,if(p%10!=1 && p%10!=9,next);
o=znorder(t=Mod(10,p));
q=sqrt(Mod(5,p));r=znlog((1+q)/2,t,o);if(r,forstep(n=r,ns,o,s[n]=0));
\\...
);
Sieve with the escape (seems to work, skipping problematic primes):
forprime(p=2^28,lim,if(p%10!=1 && p%10!=9,next);
o=znorder(t=Mod(10,p));f=factor(o);if(f[#f[,1],1]>134217728,next); \\ this escapes the "bad" primes
q=sqrt(Mod(5,p));r=znlog((1+q)/2,t,[o,f]);if(r,forstep(n=r,ns,o,s[n]=0));
\\...
);