sztosz

sztosz

Erlang :dets.open_file error I can't understand and fix

iex(1)> :dets.open_file("dets/definitions_agent", type: :set)
dets: file <<"dets/definitions_agent">> not properly closed, repairing ...
{:EXIT,
 {:function_clause,
  [
    {:lists, :thing_to_list, ["dets/definitions_agent"],
     [file: 'lists.erl', line: 603]},
    {:lists, :flatmap, 2, [file: 'lists.erl', line: 1250]},
    {:dets, :tempfile, 1, [file: 'dets.erl', line: 2786]},
    {:dets, :fsck_try, 5, [file: 'dets.erl', line: 2750]},
    {:dets, :fsck, 6, [file: 'dets.erl', line: 2727]},
    {:dets, :do_repair, 7, [file: 'dets.erl', line: 2597]},
    {:dets, :do_open_file, 4, [file: 'dets.erl', line: 2125]},
    {:dets, :do_internal_open, 5, [file: 'dets.erl', line: 1609]},
    {:dets, :init, 2, [file: 'dets.erl', line: 1285]},
    {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 247]}
  ]}}

Can someone translate this error or tell me what is going on? :confused:

It occurs only when dets table dets/definitions_agent was not closed properly, but from the dets documentation looks like it should repair itself… but instead I get this error and I’m unable to decipher it.

Marked As Solved

cmkarlsson

cmkarlsson

Ok, looks like a regression. I filed a bug report about this in Erl 18. (https://bugs.erlang.org/browse/ERL-55) it was fixed in Erl 19, but seems to no longer work in Erl 20.

Try using charstring instead of binary string when you open the file.

The bug was hard to spot because using binary string works to open a clean file, but not if a file has to be repaired.

This works for me with OTP 20 / Iex 1.6.4

:dets.open_file('dets/definitions_agent', type: :set)
dets: file "dets/definitions_agent" not properly closed, repairing ...

Where Next?

Popular in Questions Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement