Download one eml or bulk results in 0 eml size

Issue #340 resolved
Michal Mistina created an issue

Hello Janos. I've upgraded to the master branch bbd81faf0bbd and tried to download the email or tried to download more emails by using bulk download feature. It downloaded files with zero size. I've read similar issues that can be resolved by changing permissions of the /var/www/<pilerdir>/tmp. I did chmod 777 /var/www/mailpiler.mil.sk/tmp.

However I've noticed some issues while I tried to rebuild the index.

[root@mailpiler tmp]# indexer --all --rotate
Sphinx 2.1.8-id64-release (rel21-r4675)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
indexing index 'main1'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.005 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'main2'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'main3'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'main4'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'dailydelta1'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'delta1'...
collected 33 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 33 docs, 396 bytes
total 0.022 sec, 17491 bytes/sec, 1457.66 docs/sec
indexing index 'tag1'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
indexing index 'note1'...
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.001 sec, 0 bytes/sec, 0.00 docs/sec
total 10 reads, 0.000 sec, 0.3 kb/call avg, 0.0 msec/call avg
total 52 writes, 0.000 sec, 0.2 kb/call avg, 0.0 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=4698).
[root@mailpiler tmp]# reindex -a            
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
zpipe: invalid or incomplete deflate data
put 33 messages to sph_index table for reindexing

Do you think the indexing issues can be the source of the issue of the downloading 0 size message?

Comments (29)

  1. Michal Mistina reporter

    I've looked into /var/log/maillog and each time I click on the e-mail in the web ui "cannot open()" message appears in maillog. For example:

    Jul  8 13:16:25 mailpiler pilerget[2028]: /usr/local/var/piler/store/00/7c/dc/ea/4000000053abe269089fb1ec006c9e7cdcea.m: cannot open()
    

    I didn't delete piler.key files, so I don't know why shouldn't the messages be opened.

  2. Janos SUTO repo owner

    First problem: you never assign an issue to me.

    Please check if you really have piler data under /usr/local/var/piler/store/00 and not /var/piler/store/00. The latter path is the preferred place to have emails.

  3. Michal Mistina reporter

    I thought the assignment is done automatically as it is in Jira. Sorry about that. I will assign it to you in the future.

    I have the data in both store locations. It must have been mixed while I've upgraded to master branch from 0.1.24. How can I fix it? It is a test environment, so I don't mind if I delete messages in one of those locations.

  4. Janos SUTO repo owner

    Well, the piler store directory comes from the configure script. Unless you override it, it's PREFIX/var. Fixing it is possible although. First, decide in which dir you will permanently store emails. If necessary, recompile piler using --localstatedir=/var ....

    Then you have to relocate files and dirs from one place to the other, eg. /usr/local/var/piler/store/00/* => /var/piler/store/00/

    I think the simplest way is to do a cp -R (or use rsync), then remove the obsoleted directory.

  5. Michal Mistina reporter

    Thank you for suggestion. I've found out that I did not compile mailpiler with defined localstatedir parameter, so it should be at the default value. However I've used parameter localedir=/var.

    I've copied (cp -R) all messages from /usr/piler/store/00 to /usr/local/var/piler/store/00. It was easier solution from your suggestions. Now there are 2 directories 53a and 53b in /usr/local/var/piler/store/00. I removed contents of /usr/piler/store/00. Then I reindexed data as before and reindex -a command returned more of "zpipe: invalid or incomplete deflate data". These actions removed "...cannot open()" messages from /var/log/maillog after selecting the message in WebGUI. But the "...cannot open()" message is recorded four times in maillog after I click "Download (EML)" button in WebGUI. Then zero size message is downloaded.

  6. Michal Mistina reporter

    /var/log/maillog:

    Jul  9 11:37:05 mailpiler pilerget[1954]: /usr/local/var/piler/store/00/c6/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m: cannot open()
    

    Trying to get it from the location which was in the /var/log/maillog:

    [root@mailpiler ~]# ll /usr/local/var/piler/store/00/c6/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m
    ls: cannot access /usr/local/var/piler/store/00/c6/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m: No such file or directory
    

    Where is it ... you are right.. in the 53a directory:

    [root@mailpiler ~]# find / | grep 4000000053abfa950ec4308400d4a2c6d9aa.m
    /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m
    

    What do you mean by length? Size? It should be 1560 bytes:

    [root@mailpiler ~]# ls -al /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m
    -rw-r----- 1 root root 1560 Jul  8 23:00 /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m
    
    [root@mailpiler ~]# pilerget 4000000053abfa950ec4308400d4a2c6d9aa
    zpipe: invalid or incomplete deflate data
    
  7. Janos SUTO repo owner

    Please execute chown -R piler:piler /usr/local/var/piler/store/00. The file is owned by root, so user piler can't access it. If it solves the issue, then set the issue status to resolved or closed ;-)

  8. Michal Mistina reporter

    Good point, but still no luck. Only the "cannot open()" messages are gone from the /var/log/maillog. Messages are downloaded with zero size. Where else should I check permissions for piler user?

  9. Janos SUTO repo owner

    Try the following to check if user piler really has access to the file:

    su - piler

    $ ls -la /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.*

  10. Michal Mistina reporter

    Yes, it has.

    [root@mailpiler tmp]# su - piler
    -sh-4.1$ ls -la /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.*
    -rw-r----- 1 piler piler 1560 Jul  8 23:00 /usr/local/var/piler/store/00/53a/d9/aa/4000000053abfa950ec4308400d4a2c6d9aa.m
    

    Couldn't it be something wrong with the indexing of data?

  11. Janos SUTO repo owner

    Unlikely. The pilerget utility needs no index data, only the piler mysql database, and the encrypted files. Can you retrieve any messages from the archive with the pilerget utility?

  12. Michal Mistina reporter

    I've made a list of mail IDs by command:

    find /usr/local/var/piler/store/ -name \*.m -print | sed -r 's/^.{40}//' | sed -r 's/.{2}$//' > /root/mailidlist
    

    Then created a script and ran:

    #!/bin/bash
    while read line
    do
     pilerget $line
    done < mailidlist
    

    Each mail ID returned:

    zpipe: invalid or incomplete deflate data
    

    ...so, I cannot retrieve any of the messages with pilerget utility.

  13. Janos SUTO repo owner

    OK, try the following: import a new message with pilerimport, then try to retrieve it by pilerget. I suspect that either the piler.key or the iv parameter in piler.conf has changed.

  14. Michal Mistina reporter

    pilerimport didn't output anything after importing a new e-mail message... the imported e-mail is read correctly with pilerget utility and output is the whole contents of the imported e-mail

  15. Janos SUTO repo owner

    OK, so the piler installation looks ok. However the zpipe error (for older emails) indicates that the decrypted data is bogus. A possible reason can be as I described above: a changed piler.key file or a changed "iv" parameter in piler.conf.

  16. Michal Mistina reporter

    What does iv parameter? There is some generated string as a value for iv parameter. I don't know if it is correct. I didn't change it after the upgrade to the master branch.

  17. Janos SUTO repo owner

    The "iv" parameter is used for openssl by the EVP_EncryptInit_ex and EVP_DecryptInit_ex functions. Without it or if it were changed, you couldn't decrypt your emails.

  18. Michal Mistina reporter

    Please give me a few more days. I need to re-build my test environment except mailpiler. It will stay in the current state.

  19. Michal Mistina reporter

    Janos, I'm back. I have rebuilt the test environment. The mail piler stayed as it was. I have a question. If I do:

    indexer --all --rotate
    

    and consequently:

    reindex -a
    

    all e-mails should be reindexed? After executed previous 2 commands should I see all messages in WebGUI?

  20. Janos SUTO repo owner

    Correct, however I'm not sure if it will fix the decryption issue, provided that it's your actual problem. Reindexing is a troubleshooting tool to fix a corrupted sphinx index. Anyway you are free to perform it.

  21. Michal Mistina reporter

    I've tried to reindex all e-mails with aforementioned commands. After reindex -a the messages "cannot open: xx.eml" (where xx are numbers) appeared. This is weird, because there was another behaviour at the beginning of this issue. After I hit Search button I can see the newly arrived messages, but not the old one. I mean.. if I send one new message, then I execute reindex commands, I can see only that one message in the Web GUI. If I execute the reindex commands one more time the Search returns nothing.

  22. Janos SUTO repo owner

    reindex needs to write temp files as user piler to the current directory. Make sure it has such permissions.

    So resetting the sphinx database, then having a failed reindex, it's obvious that you can't find anything in the archive. Actually emails are there just sphinx has no knowledge of them until you successfully reindex old emails.

  23. Michal Mistina reporter

    Ah.. my bad. Each time I forgot to be in /tmp directory while reindexing. All right. When I am in /tmp the same issue occurs as at the beginning. That's OK. I only did like to test if I can see the messages in Web GUI even if the error "zpipe" persists. And it is true. After reindexing I am able to see also contents of the messages in the Web GUI.

  24. Michal Mistina reporter

    Really, I don't know what from the aforementioned steps helped, but bulk download and also normal EML download from Web GUI works. The zpipe error is still there. However if the functionality is in operational state we can consider the case resolved.

    Thank you.

  25. Log in to comment