fopen returns invalid handle after long server uptime
#1

So, my server (Linux VPS) has a problem with fopen. After long time since server started (about 6 hours uptime or more), fopen starts to return invalid handle on every file even they all exist. This method:

pawn Код:
new File:open = fopen("(FILE NAME HERE)", io_write); //same thing happens on all filemode
    if(open)
    {
        //File operation here
        fclose(open);
    }
Just keeps the server running with fopen not functioning until server restarts.

This problem made players data keep reset until I changed the saving system to SQLite. Even i've changed it, this problem still exists. And now the INSERT and UPDATE Query doesn't work after long time along with invalid fopen handle. it really frustating me D:

Can someone help me? thanks before.
Okay sorry for my bad English.


Solved
Quote:
Originally Posted by SiripIkan
Посмотреть сообщение
Have checked it with FileEx Include and noticed a file handle doesn't get closed after being opened. This file always called when OnPlayerConnect() triggers.
After closing this file handle now the problem is gone.

Thanks all for helping, especially for Vince..
Reply
#2

Linux is case sensitive so, "scriptfiles" and "Scriptfiles" is different in Linux.
Reply
#3

I've had this problem with linux hosts aswell, still no clue why it happens..
Reply
#4

Bump..

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Linux is case sensitive so, "scriptfiles" and "Scriptfiles" is different in Linux.
the case is fine, file can be opened (with fopen) without problems but after long time it always return invalid handle until server restarts.
Reply
#5

Are you closing the files properly when you don't need them anymore? This is pure speculation, but it might just refuse to open any more files while any previous ones aren't properly closed.
Reply
#6

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
I've had this problem with linux hosts aswell, still no clue why it happens..
What do you do when it happens?

Quote:
Originally Posted by Vince
Посмотреть сообщение
Are you closing the files properly when you don't need them anymore? This is pure speculation, but it might just refuse to open any more files while any previous ones aren't properly closed.
Yes, i've checked all of my script. All file handles closed after being opened.
Reply
#7

Quote:
Originally Posted by SiripIkan
Посмотреть сообщение
What do you do when it happens?


Yes, i've checked all of my script. All file handles closed after being opened.
Nothing special at all, it works just fine on all of the windows hosts i ever used. And i do close all of the valid file handles.
Reply
#8

Bump..

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
Nothing special at all, it works just fine on all of the windows hosts i ever used. And i do close all of the valid file handles.
Hmm.. that's strange :/
Reply
#9

Since its a host, it may have limited read/write quotas...
Reply
#10

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
Since its a host, it may have limited read/write quotas...
It could be the problem... But how to check it?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)