AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved nvault crashing the server (https://forums.alliedmods.net/showthread.php?t=294925)

Natsheh 03-11-2017 12:12

nvault crashing the server
 
im using to store data nvault and its crashing the server when map change or restart

OciXCrom 03-11-2017 12:32

Re: nvault crashing the server
 
Your post could explode from so much information!

Bugsy 03-11-2017 12:40

Re: nvault crashing the server
 
Taking a guess here but could be a corrupt vault. Try deleting the vault and restarting the server. Commonly happens when the vault is not closed gracefully after a server crash.

Natsheh 03-11-2017 13:48

Re: nvault crashing the server
 
yeah Bugsy after i delete the vaults it stops the crashes but comes back again on map change in which forward is the best thing to close the vault!

OciXCrom 03-11-2017 14:02

Re: nvault crashing the server
 
In plugin_end? To prevent such crashes, check if the key that is being saved is not empty. This has happened to me before when saving data with bots. Their name/ip/steam would come up blank.

Bugsy 03-11-2017 15:22

Re: nvault crashing the server
 
Show all code where data gets written to the vault. If you were never calling nvault_close() then you are asking for trouble.

OciXCrom, nVault should allow empty keys and data.

OciXCrom 03-11-2017 15:39

Re: nvault crashing the server
 
I meant the key, not the data, my bad. I was trying to understand why the server is crashing and I used your nVault editor to check the vault file while the server was crashing on startup. The key value was blank and deleting it fixed the problem (deleting the entire vault file did the job as well). The crashes stopped for good after checking if the key is empty and not saving if it is.

Now, I don't know if it was really the key that's empty or the entire vault entry was corrupted, but I do know that a simple if(!szKey[0]) return check fixed it.

Natsheh 03-11-2017 18:14

Re: nvault crashing the server
 
What happens if i saved empty data ?

I open the vault in plugin cfg
I close the vault in plugin end

Loading the data at client authorization
Saving at client disconnect

Key is authid

And what nvault_get returns when no key found

I also save empty data

Bugsy 03-11-2017 19:16

Re: nvault crashing the server
 
Nothing happens, nvault allows saving empty data.

Your timing for doing things looks good.

nvault_get() needs to be used carefully. If you want to retrieve data and know when the key did or did not exist, use nvault_lookup().

Example: nvault_get() will return 0 when it found the key and the value is 0 and it will do the same if no key is found at all. Its useful because you can read directly into an integer or float variable but you need to know what you're doing when coding.

Natsheh 03-12-2017 06:17

Re: nvault crashing the server
 
So what nvautl get returns when i saved in a key value 5 as integer
Dose it returns 5 or 0?


All times are GMT -4. The time now is 18:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.