zytzagoo / smtp-validate-email

A PHP library for performing email addresses validation via SMTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timed out in recv

rubenCodeforges opened this issue · comments

Hey there , first thx for this cool stuff.
Second , im using you lib with symfony and JMSJobQueueBundle the JMSJob is just creating a job for daemon ( im using supervisor ) .
The job of this guys is to validate a list of emails .
For test purpose ive started a job with about 3k emails.

the code is simple enough :

 $validator = new ValidatorEmail($mail,$this->sender,array(
                'domainMoreInfo' => true,
                'delaySleep' => array(1,10)
                'noCommIsValid' => 0,
                'catchAllIsValid' => 1
            ));
            $results = $validator->getResults();

This is just a snippet from my ValidationCommand , but this part is the important and most time consuming .
Perhaps it is not a good idea to run such a bunch of emails atones but acctualy should be working within a daemon and here i came to the "Timed out in recv " after 16687 seconds of runing as daemon , its about 5 hours.

So maybe i can raise the timeout value ?

Oh and yeh the stack trace :

 ExceptionTimeout: Timed out in recv  -+

    in /var/www/html/validator/vendor/ddtraceweb/smtp-validator-email/lib/SmtpValidatorEmail/Smtp/Smtp.php at line 436  -
                // have we timed out?
                $info = stream_get_meta_data($this->socket);
                if (!empty($info['timed_out'])) {
                    throw new ExceptionTimeout('Timed out in recv');
                }
                // did we actually receive anything?
                if ($line === false) {
    at Smtp ->recv ('120')
    in /var/www/html/validator/vendor/ddtraceweb/smtp-validator-email/lib/SmtpValidatorEmail/Smtp/Smtp.php at line 464  +
    at Smtp ->expect ('220', '120')
    in /var/www/html/validator/vendor/ddtraceweb/smtp-validator-email/lib/SmtpValidatorEmail/Smtp/Smtp.php at line 232  +
    at Smtp ->helo ()
    in /var/www/html/validator/vendor/ddtraceweb/smtp-validator-email/lib/SmtpValidatorEmail/ValidatorEmail.php at line 145  +
    at ValidatorEmail ->__construct ('bibx1rab@cervantes.es', 'ruben@codeforges.com', array('domainMoreInfo' => true, 'delaySleep' => array('1', '10'), 'noCommIsValid' => '0', 'catchAllIsValid' => '1'))
    in /var/www/html/validator/src/Magnetomedia/AdminBundle/Command/ValidateFileCommand.php at line 41  +
    at ValidateFileCommand ->execute (object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php at line 252  +
    at Command ->run (object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php at line 896  +
    at Application ->doRunCommand (object(ValidateFileCommand), object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php at line 193  +
    at Application ->doRun (object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php at line 96  +
    at Application ->doRun (object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/jms/job-queue-bundle/JMS/JobQueueBundle/Console/Application.php at line 44  +
    at Application ->doRun (object(ArgvInput), object(ConsoleOutput))
    in /var/www/html/validator/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php at line 124  +
    at Application ->run (object(ArgvInput))
    in kernel.root_dir/console at line 28  +

Hey, I'd like to help, but I'm not sure I have enough info?

Have you tried reducing/simplifying the issue? What happens when you try validating that same email in a reduced/simplified scenario? (without all the other emails and without the job queue?)

How is the "daemon" set up? If there's a worker that should pull and validate emails one-by-one from a queue, why would it be connected to a single remote server for such a long time? (the only reason that comes to mind is that the SMTP you're connecting to is slowing you down intentionally, because it doesn't "like" you anymore).

Are you giving the lib a single email each time or an array of 3k emails at once? Being connected for 16687 seconds seems odd, especially since the timeout from the backtrace appears to be set to 120 seconds? (side note: timeout should really be an int, and I should probably cast it as such... but I'm not really sure that's what's causing your issue currently)...

Getting a reduced test-case would really help with debugging this further...

Hmm... it appears you're not really using this library but a different one: https://github.com/ddtraceweb/smtp-validator-email

Different coding style (+ OOP refactoring) aside, it might be based on code in this one (hard to tell with absolute certainty, only that repo's author really knows how and why it came to be).

The re-licensing as MIT is also interesting and potentially problematic (to say the least).

But since there's no acknowledgments or references back to this lib/code (and feeling as though there really should be), continuing this discussion doesn't feel like a great way to spend my (free) time.

I really have no knowledge of that other library's code (and any potential differences). Perhaps you should raise an issue over there?

Whoops , sorry