pmemlog open function with invalid arguments

29 views
Skip to first unread message

Gao Neal

unread,
Aug 26, 2016, 11:14:31 PM8/26/16
to pmem
Hi,
As I'm using pmemlog library to build a log service and doing integration tests.
Somehow I cannot open the file after a sudden kill of the log service. The errno shows "invalid argument".
BTW, i'm testing on non pmem files, but pmem library should be able to detect that and the metadata should not be inconsistent, right? because pmem library will automatically call msync if the file is not on pmem device.
Any idea why this happens or how I can get more logs/information.

Thanks

Andy Rudoff

unread,
Aug 29, 2016, 9:03:26 AM8/29/16
to pmem
Hi,

All the libraries have debug versions which will log lots of extra information on error conditions. See the "DEBUGGING AND ERROR HANDLING" section of the man page at http://pmem.io/nvml/libpmemlog/libpmemlog.3.html  If the debug info doesn't help, please either send it to me or send a small program that recreates the issue, if possible.

And yes, you are correct that debugging your code on regular files should work just fine -- the library detects it and uses msync() to flush changes instead of user-space cache flushes.

Thanks,

-andy

Krzysztof Czurylo

unread,
Aug 29, 2016, 9:55:52 AM8/29/16
to pmem
Hi,

First of all, I'm quite surprised that you can experience such a problem with pmemlog pool. The pmemlog metadata is just one integer (offset), so even if pmemlog_append() operation is torn by program crash, you should still be able to open the pool - only the last append data would be lost. Perhaps your problem is related to the changes you've made to pmemlog API?

Anyway, as Andy said, using debug version of libpmemlog may help to identify the problem (you may need to set the higher log level to see more details, i.e.: export PMEMLOG_LOG_LEVEL=4).
But you can also use our "pmempool" utility to diagnose the issue:
$ pmempool check -v <path_to_your_pool_file>

HTH,
K.

Gao Neal

unread,
Aug 29, 2016, 12:27:36 PM8/29/16
to pmem

It turns out(most likely) that the error comes from killing the program when creating. So my simple solution is to delete such files when error returns. 

Thanks about the debug info. Really helpful.

Krzysztof Czurylo

unread,
Aug 29, 2016, 12:52:26 PM8/29/16
to pmem
Ha! That was one of the ideas I had, but I assumed it very unlikely that the program was killed in a middle of pmemlog_create().
And yes, there is nothing you can do in such case, but delete the file and create a new one.

K.
Reply all
Reply to author
Forward
0 new messages