Auto-storing tab setup failed

pch1900's profile image pch1900 posted 5 years ago in General Permalink

Yesterday I updated to version 10.2.0/5599 (64 bit) and since about 22:00 UTC 18/06/2019 I've been getting repeated messages coming up saying "Auto-storing tab setup failed - Unable to write to C:\Users\<username>\AppData\Roaming\HeidiSQL\tabs.in" The worst thing is these messages steal focus so whatever I am doing elsewhere on the PC, even writing this, gets interrupted.

Any thoughts on this?

In the meantime I'm going to have to wind back to a previous version.

ansgar's profile image ansgar posted 5 years ago Permalink

This looks as if you lack privileges to write to C:\Users\<username>\AppData\Roaming\HeidiSQL\

Can you please post your Windows version, and please try to create a file in that directory yourself.

pch1900's profile image pch1900 posted 5 years ago Permalink

Win 7 Professional Version 6.1 (Build 7601: service pack 1) fully updated.

Creating files in that folder is no problem. The tabs.ini file did have a few lines of text in it but the file has just been emptied by HiediSQL - see snapshot - and as I've been writing this I have been interrupted and tabs.ini is now timestamped 08:59 and contains

[2019-06-18_11-28-25-341] BackupFilename=C:\Users\<user>\AppData\Roaming\HeidiSQL\Backups\query-tab-2019-06-18_11-28-25-341.sql pid=4632 EditorHeight=242 HelpersWidth=253

File now timestamped 09:00

1 attachment(s):
  • Image1
ansgar's profile image ansgar posted 5 years ago Permalink

Ok, I suppose you did not have two or more instances of HeidiSQL open, accessing that tabs.ini from two sides?

Any way, I need to fix these random errors.

pch1900's profile image pch1900 posted 5 years ago Permalink

I have three instances open, connecting to three different servers. The tabs.ini file is currently being updated every 4 to 6 seconds. The three instances are probably trying to access at the same time. I've been operating this way for years, no problem until now.

ansgar's profile image ansgar posted 5 years ago Permalink

Yes, I was just asking. Multiple instances should not be a problem. I just have to find a way to prevent parallel accesses to that file.

pch1900's profile image pch1900 posted 5 years ago Permalink

Thanks for your prompt responses :-)

serg's profile image serg posted 5 years ago Permalink

Hi, I have the same message: Auto-storing tab setup failed. External exception C06D007F Version 10.2.0.5599 32-bit, Portable Windows Server 2003, 64-bit

ansgar's profile image ansgar posted 5 years ago Permalink

@serg, could you please check whether you have this folder created automatically by HeidiSQL:

C:\Documents and Settings\<yourusername>\Application Data\HeidiSQL\tabs.ini

I suspect some issue in HeidiSQL with these old XP-aera Windows versions, while I am not able to test that. Several years passed since I had an XP computer. Windows Server 2003 is from the XP aera, is it?

serg's profile image serg posted 5 years ago Permalink

Folder is created, but there are no files inside.

And I'm using portable version. I think, it should create in program's folder.

Yes, 2003 is a server version of XP.

ansgar's profile image ansgar posted 5 years ago Permalink

Yes, the portable version saves its tabs.ini and backups in the folder where you have heidisql.exe and friends.

Windows Server 2008 works without crash.

I'm beginning to think I should just drop XP support.

ansgar's profile image ansgar posted 5 years ago Permalink

I pushed some changes, so the latest build should disable the tab re/store feature if writing tabs.ini failed. Could you please update and try again?

yphastos's profile image yphastos posted 5 years ago Permalink

Hello, joining the party here.

I've been having the same problem with the tab.ini file, but I get a couple of very similar messages, apparently randomly.

one is

---------------------------
Error
---------------------------
Auto-storing tab setup failed

Could not open file C:\users\diegodurand\Application Data\HeidiSQL\tabs.ini
---------------------------
OK   
---------------------------

and the other

---------------------------
Error
---------------------------
Auto-storing tab setup failed

Unable to write to C:\users\diegodurand\Application Data\HeidiSQL\tabs.ini
---------------------------
OK   
---------------------------

The thing is, the file IS being writen, i.e. it does have read/write access. in fact it has been writen just now. The file DOES have content.

I am running HeidiSQL trhough wine, so the full path to tabs.ini is: /Users/<user>/.wine/drive_c/users/<user>/Application Data/HeidiSQL/tabs.ini

I am sitll @10.20.5599 instead of latest build, so restoring SHOULD be enabled

I am running two heidi instances.

I tried opening a third instance, creating a few dummy files, and closing (that instance) of heidi, it did prompt to save them, so I didn't manually save any, but when reopening heidi (3rd instance), it still didn't reopen the previous tabs.

Let me know if I can help testing any further.

I also see you are currently working on the issue on a different post, @

heidisql .com/forum.php?t=34044#p34148 (sorry cant post links yet),

but since this seems to be more specificaly related to tab restoring, I am posting this here.

ansgar's profile image ansgar posted 5 years ago Permalink

Hm, apparently my multi-instance-access-to-file-logic is just shit:

  • if the file exists, then Heidi checks in a loop (15 attempts with a delay of 200ms) if it can touch the file, with the following code:
hFile := CreateFile(PChar('path\to\tabs.ini'), GENERIC_WRITE, 0, nil, OPEN_EXISTING, 0, 0);
Result := hFile <> INVALID_HANDLE_VALUE;
CloseHandle(hFile);
  • now that already raised your first error "Could not open file"
  • if the file could be touched successfully, then the next thing is to create an .ini object:
Result := TIniFile.Create('path\to\tabs.ini');
  • this line, or the following high-level methods of TIniFile raised your second error "Unable to write to"
yphastos's profile image yphastos posted 5 years ago Permalink

Just some ideas:

Idea #1

  1. For every new instance, create a tabs file for it, with some kind of id (e.g timestamp of opening).

  2. while instances are open, fequently save tabs to each instances unique file. that way you wont lock the same file since each has its own.

  3. when an instance closes, flag the file somehow, to show it doesn't have a 'parent' instance open.

  4. If new instance opens, load all the flagged files and load all the tabs in the new instance as its initial tabs. This would allow that if there were several files from several instances, the new one will load all of them together.

Idea #2

Just forget about tabs.ini file, I see you already save queries into the Backups folder, so why not just load already unopened files in every new instance?

  • Every time either instance saves a query, save it to backups (as already done),
  • every time a tab is closed manually (i.e. single tabs), delete it from backups (either if the user saved it to a file, or ignored the changes), but of course prompt to save if such option is active.
  • every time an instance closes, save all its queries to the corresponding files. In this case, you should save EVERY query, saved, modified, or not, and do not prompt for each (IMO the point of restoring is not needing to be asked to save or discard each tab).
  • every time a new instance opens, just load all the 'not currently open' queries in it.

the whole point is to not depend on a single file to manage 'sesions', and avoid read/write/locking the same file from different instances.

This are just general ideas, I don't know how complicated would they be to implement of if they would work at all. However I hope they are useful.

Or maybe just research about how other apps manage this, the perfect example is sublime text, although i really don't know how it handles multiple instances, since I use it just with one (as opposed to heidi, in which I almost use two).

Let me know if I can help with further testing.

serg's profile image serg posted 5 years ago Permalink

The problem is not in access to the file, but in the "External exception C06D007F" (in my case). This is something related to delayed load from DLLs (I don't know).

humbads's profile image humbads posted 5 years ago Permalink

I love the auto-saving tabs feature, but I am getting the same error described above in Windows 10 Pro 64-bit build 1809 when I leave multiple HeidiSQL instances open.

SessionName: Error
Auto-storing tab setup failed
Unable to write to C:\Users\UserName\AppData\Roaming\HeidiSQL\tabs.ini

Depending on how long I leave the windows open, there could be many, duplicate error message dialogs stacked on top of each other, that I have to dismiss individually.

I suggest creating a lock file before writing to tabs.ini the way Sqlite does it, or you could use the LockFile API. Or, better yet, add Sqlite library to your project and save the data to a Sqlite database file instead of an INI file. Sqlite will handle all those file locking and concurrency issues for you.

tvernon's profile image tvernon posted 5 years ago Permalink

Receiving the same message on Windows 7. HeidiSQL 10.2.0.5599.

I generally have a single instance of HeidiSQL open but will run up a second instance periodically and close it shortly after. The primary instance is open for days at a time and the error occurs occassionally. I haven't been able to pinpoint a pattern.

pgietz's profile image pgietz posted 4 years ago Permalink

I'm new to heidi. i solved the problem unchecking \tools\preferences\general\allow multiple instances of the application .

pch1900's profile image pch1900 posted 4 years ago Permalink

Yes, that does work but it stops me being able to do my work. I need to connect to three different servers at the same time, I can't do that with a single instance. (Unless someone knows how?)

ansgar's profile image ansgar posted 4 years ago Permalink

HeidiSQL can connect to multiple servers in one window. This is supported since quite a few years.

pch1900's profile image pch1900 posted 4 years ago Permalink

So it does, thanks, I've found it. I think I still prefer to run separate windows though.

ansgar's profile image ansgar posted 4 years ago Permalink

That "Auto-storing tab setup" is a message from an outdated build. If you see that, please update to the latest HeidiSQL build.

Please login to leave a reply, or register at first.