Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 47044
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: e.kuemmerle [...] fz-juelich.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.18
Fixed in: 3.19



Subject: $imap->search does not return
Hi, I connect to an MS Exchange server (Version 8.1.240.0). With IMAPClient-3.18, the function $imap->search(...) does not return, i.e. my application hangs. With IMAPClient-3.16, everything works fine. Best regards, Eberhard
Does the search request eventually timeout (after 10 min?). Could you enable Debug ($imap->Debug(1)) before the search and attach the output to this bug? If nothing is logged, could you do a brief tcpdump to capture the search being sent and and any data returned from the server?
Yes, the search request times out after 10 minutes. And here is the Debug output: Sending literal: 3 UID SEARCH {65} then: UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussenring Sending: 3 UID SEARCH {65} Sent 19 bytes ERROR: timeout waiting 600s for data from server at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1498 Mail::IMAPClient::_read_line('Mail::IMAPClient=HASH(0x7b81b0)') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1287 Mail::IMAPClient::_get_response('Mail::IMAPClient=HASH(0x7b81b0)', 'Regexp=SCALAR(0x7c80e8)', '+') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1387 Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x7b81b0)', '3 UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenri...', 0) called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1252 Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1164 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', '{65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM Test...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussen...') called at ./get_tixi-alarm.pl line 23 ERROR: Error sending '3 UID SEARCH {65} UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussenring': timeout waiting 600s for data from server at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1253 Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1164 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', '{65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM Test...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussen...') called at ./get_tixi-alarm.pl line 23 ERROR: Error sending '3 UID SEARCH {65} UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussenring': timeout waiting 600s for data from server at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1209 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH {65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', '{65}\x{d}\x{a}UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM Test...') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussen...') called at ./get_tixi-alarm.pl line 23 Use of uninitialized value $msg in concatenation (.) or string at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2223. split_sequence: length(1000-49) parts: 0 Use of uninitialized value $msgspec in hash element at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2281. ERROR: NO not connected at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1394 Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x7b81b0)', '4 UID SEARCH ALL', 0) called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1252 Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1164 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2323 Mail::IMAPClient::messages('Mail::IMAPClient=HASH(0x7b81b0)') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1908 Mail::IMAPClient::fetch('Mail::IMAPClient=HASH(0x7b81b0)', undef, 'BODY[TEXT]') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1061 Mail::IMAPClient::body_string('Mail::IMAPClient=HASH(0x7b81b0)', undef) called at ./get_tixi-alarm.pl line 29 Trying command when NOT connected! at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 95 Mail::IMAPClient::LastError('Mail::IMAPClient=HASH(0x7b81b0)', 'NO not connected') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1394 Mail::IMAPClient::_send_line('Mail::IMAPClient=HASH(0x7b81b0)', '4 UID SEARCH ALL', 0) called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1252 Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1164 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2323 Mail::IMAPClient::messages('Mail::IMAPClient=HASH(0x7b81b0)') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1908 Mail::IMAPClient::fetch('Mail::IMAPClient=HASH(0x7b81b0)', undef, 'BODY[TEXT]') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1061 Mail::IMAPClient::body_string('Mail::IMAPClient=HASH(0x7b81b0)', undef) called at ./get_tixi-alarm.pl line 29 ERROR: Error sending '4 UID SEARCH ALL': NO not connected at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1253 Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1164 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2323 Mail::IMAPClient::messages('Mail::IMAPClient=HASH(0x7b81b0)') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1908 Mail::IMAPClient::fetch('Mail::IMAPClient=HASH(0x7b81b0)', undef, 'BODY[TEXT]') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1061 Mail::IMAPClient::body_string('Mail::IMAPClient=HASH(0x7b81b0)', undef) called at ./get_tixi-alarm.pl line 29 ERROR: Error sending '4 UID SEARCH ALL': NO not connected at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1209 Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x7b81b0)', 'UID SEARCH ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1339 Mail::IMAPClient::_imap_uid_command('Mail::IMAPClient=HASH(0x7b81b0)', 'SEARCH', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2417 Mail::IMAPClient::search('Mail::IMAPClient=HASH(0x7b81b0)', 'ALL') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 2323 Mail::IMAPClient::messages('Mail::IMAPClient=HASH(0x7b81b0)') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1908 Mail::IMAPClient::fetch('Mail::IMAPClient=HASH(0x7b81b0)', undef, 'BODY[TEXT]') called at /usr/lib/perl5/site_perl/5.10.0/Mail/IMAPClient.pm line 1061 Mail::IMAPClient::body_string('Mail::IMAPClient=HASH(0x7b81b0)', undef) called at ./get_tixi-alarm.pl line 29
From the data you provided, I can see you're calling something like: $imap->search('UNSEEN SUBJECT "Abnormer Messwert Aussenring" FROM TestAussen...') The change in behavior you are seeing was due to a change made for: https://rt.cpan.org/Ticket/Display.html?id=44936 The goal was to have search() do what I mean, and it looks like we failed you here. The docs for have only showed usage for search as '$imap->search(@args)' but your usage is more like $imap->search($string)... I'm not convinced either is right or wrong, but I've yet to find a good solution that would DWIM all the time. Here are notes in the docs for search() once the update was made: "As of version 3.17 search tries to "DWIM" by automatically quoting things that likely need quotes when the words do not match any of the following: ... To avoid the automatic quoting, you can specify args as scalar references (SCALAR) and the values of those SCALAR refs will be passed along as-is." To get things working again, you could do one of two things: $imap->search( \$string ) # assumes you are quoting things properly Or let Mail::IMAPClient do the quoting for you: $imap->search("UNSEEN", "SUBJECT", $subject, "FROM", $from, ... ) I'll think about this a little bit and see if I can make backwards compatibility a bit better...
I have released Mail::IMAPClient 3.19 which should now do the right thing when passing in a single string argument. In this case, the argument is passed as-is to do the SEARCH and no quoting is done. Please reopen or submit a new bug if you find this doesn't work for you with 3.19. Sorry for the problems!
3.19 works fine for me, thank you!