B4J Question Too many files open

TomDuncan

Active Member
Licensed User
Longtime User
I am doing a reading a file into a list. After 20 or so iterations I get too many files open. This does not happen on my windows machine in debug mode but on my Linux server. I am running with Sudo.
For some reason cannot get b4j-bridge working either. It is a 64 bit Linux Light distribution.
 

TomDuncan

Active Member
Licensed User
Longtime User
Yep,
lst = File.ReadList(Noaa_Directory,"NOAA-" & noaa_date & ".txt")
However, last night removed that part of the code.
Error still coming.
error: User limit of inotify instances reached or too many open files.
I use FileWatcher to check on files updated, will do some checks today.
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Have set everything going in fast motion. (not 10 mins between updates)
I comes down to a bit of code (code snippet: File Copy)
I have changed this to..
B4X:
    If File.Exists(sourcefolder,Filename) Then
        If ((lt > a_t) And (lt < b_t)) Then
            wait for (File.CopyAsync(sourcefolder,Filename,Final,"/Current_Image.jpg"))  complete(success As Boolean)
            If success = True Then
                Log("new image at " & local & " from " & Camera)
                Log("." & success)
            End If
                
            
'            Dim fsize,zero=0 As Long
'            Dim fis,fos As JavaObject
'            Dim fsiCH, fsoCH As JavaObject
'            fis.InitializeNewInstance("java.io.FileInputStream",Array(sourcefile))
'            fos.InitializeNewInstance("java.io.FileOutputStream",Array(destfile))
'            Dim start As Long = DateTime.Now
'            Try
'                fsiCH = fis.RunMethodJO("getChannel",Null)
'                fsoCH = fos.RunMethodJO("getChannel",Null)
'                fsize = fsiCH.RunMethod("size",Null)
''                Log("filesize : "& fsize)
'                If fsiCH<>Null And fsoCH<>Null Then
'                    fsoCH.RunMethod("transferFrom",Array(fsiCH,zero,fsize))
'                End If
'            Catch
'                Log("copy failed")
'                Log(LastException.Message)
'            End Try
'            Try
'                fsiCH.RunMethod("close",Null)
'                fsoCH.RunMethod("close",Null)
'            Catch
'                Log("close failed")
'                Log(LastException.Message)
'            End Try
'            fis.RunMethod("close",Null)
'            fos.RunMethod("close",Null)
'            Log("Loading time = " & (DateTime.Now - start) & " ms")
        End If
    End If

AND ALL seems to be ok.
Am now running on the Linux box to see what happens.
Tom
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…