StackOverflow

All your suggestions, requests and ideas for future development
Post Reply
zetxek
Posts: 1
Joined: 17 Jan 2016, 21:57

StackOverflow

Post by zetxek » 17 Jan 2016, 22:00

Hi, I am getting a StackOverflow error while scanning a directory. The script has been working fine for weeks - but eventually some change in the folder has caused some trouble.

Code: Select all

[email protected]:~/scripts$ filebot -version
FileBot 4.6 (r3052) / Java(TM) SE Runtime Environment 1.8.0_51 (headless)

Code: Select all

[email protected]:~/scripts$ filebot -script fn:amc --log all --log-file "/home/osmc/scripts/amc.log" -r --action move -non-strict "/media/r2d1/descargas/completos/" --def "seriesFormat=/media/r2d1/Series/{n}/{'S'+s}/{fn}" --def reportError=y Locking /home/osmc/scripts/amc.log
Run script [fn:amc] at [Sun Jan 17 22:55:03 CET 2016]
Parameter: seriesFormat = /media/r2d1/Series/{n}/{'S'+s}/{fn}
Parameter: reportError = y
Argument: /media/r2d1/descargas/completos
StackOverflowError: java.lang.StackOverflowError
java.lang.StackOverflowError
	at java_io_File$isDirectory$0.call(Unknown Source)
	at Script1.resolveInput(Script1.groovy:152)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
	at Script1.resolveInput(Script1.groovy:166)
	at Script1$_resolveInput_closure90.doCall(Script1.groovy:166)
Failure (°_°)

Anything I can try for more verbose logging, and maybe know the offending directory?

User avatar
rednoah
The Source
Posts: 16115
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: StackOverflow

Post by rednoah » 18 Jan 2016, 05:24

The amc script is never called with -r so this might be an issue.

My first guess is that your input folder contains a cyclical tree structure (e.g. due to symlinks).

By default, there isn't any additional logging that you could enable that would help in this case. You can fork the amc script and add your own logging.
:idea: Please read the FAQ and How to Request Help.

Daztren
Posts: 2
Joined: 11 Jul 2019, 22:27

Re: StackOverflow

Post by Daztren » 11 Jul 2019, 22:50

I hit the same errors.

For me the issue was that there was a .rar file that contained another .rar file with the same name.
As amc.groovy extract() extracts them to the same directory (it just uses the .rar basename), it thinks pre-existing files in the extraction directory are newly extracted and re-processes them.

The .rar file in question is an old scene release containing dvd-type subtitles, with the .sub file being separately compressed (some video players can load rarred .sub files):

Code: Select all

- release-name.rar
   - release-name.idx
   - release-name.rar
      - release-name.sub
So amc.groovy would extract the outer rar to extractFolder/release-name, then find the inner rar and extract it to the same folder, and then finds the inner rar again, etc.

I don't know groovy well enough to fix this properly, but I used the following hack to workaround the issue (so that the rar files are extracted to different directories in my case):

Code: Select all

--- amc.groovy-ORIG     2019-07-12 01:13:00.201045676 +0300
+++ amc.groovy  2019-07-12 01:30:28.971680387 +0300
@@ -188,7 +188,7 @@
 temporaryFiles = []
 
 def extract(f) {
-       def folder = new File(extractFolder ?: f.dir, f.nameWithoutExtension)
+       def folder = new File(extractFolder ?: f.dir, new StringBuilder().append(f.nameWithoutExtension).append(f.length()).toString())
        def files = extract(file: f, output: folder.resolve(f.dir.name), conflict: 'auto', filter: { it.isArchive() || it.isVideo() || it.isSubtitle() || (music && it.isAudio()) }, forceExtractAll: true) ?: []
 
        extractedArchives += f

User avatar
rednoah
The Source
Posts: 16115
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: StackOverflow

Post by rednoah » 12 Jul 2019, 03:40

That's not what I get.

Archive-in-Archive sample file:

Code: Select all

AMC-TEST/TEST.zip/TEST.zip/[Natsumi no Sekai] Vinland Saga - 03 VOSTFR [1080p AAC].mp4
Console Output:

Code: Select all

Read archive [TEST.zip] and extract to [TEST/AMC-TEST]
Extracting files [TEST/AMC-TEST/TEST.zip]
Read archive [TEST.zip] and extract to [TEST/AMC-TEST/TEST/AMC-TEST]
Extracting files [TEST/AMC-TEST/TEST/AMC-TEST/[Natsumi no Sekai] Vinland Saga - 03 VOSTFR [1080p AAC].mp4]
Input: TEST/AMC-TEST/TEST/AMC-TEST/[Natsumi no Sekai] Vinland Saga - 03 VOSTFR [1080p AAC].mp4
Since it'll create a directory structure, it'll just go deeper and deeper with nested archives.

:?: Are you perhaps using the --def extractFolder option?



EDIT:

I've made some changes. Please try the latest revision of the amc script.

:idea: https://github.com/filebot/scripts/comm ... 39ac0dc5a4
:idea: Please read the FAQ and How to Request Help.

Daztren
Posts: 2
Joined: 11 Jul 2019, 22:27

Re: StackOverflow

Post by Daztren » 12 Jul 2019, 11:23

rednoah wrote:
12 Jul 2019, 03:40
:?: Are you perhaps using the --def extractFolder option?
Yes, I am. Sorry, I forgot it was not the default.

rednoah wrote:
12 Jul 2019, 03:40
I've made some changes. Please try the latest revision of the amc script.

:idea: https://github.com/filebot/scripts/comm ... 39ac0dc5a4
Seems to no longer hit the error, thanks :)

Post Reply