Issue #3 resolved
shturman8 NA
created an issue

For 1.4.8 and 1.4.8.2 starting with -proxy

fan afBedSheet -env dev -proxy AppModule 8080

get error:

[MainProxied] Cannot boot
sys::IOErr: Invalid escape sequence [Line 4]
  fanx.serial.ObjDecoder.err (ObjDecoder.java:665)
....

Comments (14)

  1. Steve Eynon

    Hi, can you cut'n'paste ALL the logs that are printed before the error. I'm particularly interested in the java line that's output.

    What system / platform is it running on?

    Cheers.

  2. shturman8 NA reporter

    OS X 10.9.4 Java 1.7.0_25

    [01:16:10 11-марта-15] [info] [afBedSheet] Found pod 'bednap'
    [01:16:10 11-марта-15] [info] [afBedSheet] Found mod 'bednap::AppModule' 
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definitions from pod 'bednap'
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for bednap::AppModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afIocConfig::ConfigModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetEnvModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afIocEnv::IocEnvModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afEfanXtra::EfanXtraModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afPillow::PillowModule
    [01:16:10 11-марта-15] [info] [afIoc] Adding module definition for afDuvet::DuvetModule
    [01:16:11 11-марта-15] [info] [web] WispService started on port 8080
    [01:16:11 11-марта-15] [info] [afBedSheet] Starting BedSheet Proxy on port 8080
    [01:16:11 11-марта-15] [info] [afBedSheet] Cached the timestamps of 59 pods
    [01:16:11 11-марта-15] [info] [afBedSheet] Launching BedSheet WebApp 'Bed Nap Tutorial' on port 8081
    [01:16:11 11-марта-15] [info] [afBedSheet] Executing external process:
    
    java -cp /Users/Shturman/Programming/Tools/Fantom/lib/java/sys.jar -Dfan.home=/Users/Shturman/Programming/Tools/Fantom fanx.tools.Fan afBedSheet::MainProxied "afIoc::RegistryBuilder\n{\n_moduleTypes=[bednap::AppModule#,afBedSheet::BedSheetModule#,afIocConfig::ConfigModule#,afBedSheet::BedSheetEnvModule#,afIocEnv::IocEnvModule#,afEfanXtra::EfanXtraModule#,afPillow::PillowModule#,afDuvet::DuvetModule#]\noptions=[\"afBedSheet.env\":\"dev\",\"afBedSheet.appModule\":bednap::AppModule#,\"afBedSheet.proxyPort\":8080,\"afBedSheet.pingProxy\":true,\"afBedSheet.appPort\":8081,\"afBedSheet.appPodName\":\"bednap\",\"afBedSheet.appName\":\"Bed Nap Tutorial\"]\nsuppressLogging=false\n}"
    
    [01:16:12 11-марта-15] [err] [MainProxied] Cannot boot
    sys::IOErr: Invalid escape sequence [Line 4]
      fanx.serial.ObjDecoder.err (ObjDecoder.java:665)
      fanx.serial.ObjDecoder.err (ObjDecoder.java:662)
      fanx.serial.Tokenizer.err (Tokenizer.java:522)
      fanx.serial.Tokenizer.escape (Tokenizer.java:436)
      fanx.serial.Tokenizer.str (Tokenizer.java:359)
      fanx.serial.Tokenizer.doNext (Tokenizer.java:76)
      fanx.serial.Tokenizer.next (Tokenizer.java:50)
      fanx.serial.ObjDecoder.consume (ObjDecoder.java:727)
      fanx.serial.ObjDecoder.<init> (ObjDecoder.java:42)
      fan.sys.InStream.readObj (InStream.java:575)
      fan.sys.InStream.readObj (InStream.java:572)
      fan.sys.Buf.readObj (Buf.java:354)
      afBedSheet::BedSheetBuilder.fromStringy (BedSheetBuilder.fan:114)
      afBedSheet::MainProxied.run (MainProxied.fan:14)
      util::AbstractMain.main (AbstractMain.fan:370)
      java.lang.reflect.Method.invoke (Method.java:483)
      fan.sys.Method.invoke (Method.java:559)
      fan.sys.Method$MethodFunc.callOn (Method.java:230)
      fan.sys.Method.callOn (Method.java:139)
      fanx.tools.Fan.callMain (Fan.java:175)
      fanx.tools.Fan.executeType (Fan.java:140)
      fanx.tools.Fan.execute (Fan.java:41)
      fanx.tools.Fan.run (Fan.java:298)
      fanx.tools.Fan.main (Fan.java:336)
    
  3. Steve Eynon

    Hi, thanks for reporting this. I'm pretty sure the issue is platform dependant because on Windows, the command line args loose their string escaping - which I wasn't expecting.

    Could you run the following class for me:

    class Poo {
        Void main() {
            echo("Plaform: " + Env.cur.platform)
            echo("Fantom : " + ["string":"string"].toCode.toCode)
            echo("Cmd Arg: " + Env.cur.args[0])
        }
    }
    

    with this command:

    C:\> fan Poo.fan "[sys::Str:sys::Str][\"string\":\"string\"]"
    

    For comparison, this is what I get:

    Plaform: win32-x86_64
    Fantom : "[sys::Str:sys::Str][\"string\":\"string\"]"
    Cmd Arg: [sys::Str:sys::Str]["string":"string"]
    

    Thanks,

    Steve.

  4. Steve Eynon

    Hmm... I'm a bit confused as to what's going on then...

    Could you try this:

    class Poo {
        Void main() {
            arg := Env.cur.args[0] 
            str := "\"" + arg.replace("\"", "\\\"") + "\""
            fan := (Str) str.in.readObj
            obj := fan.in.readObj
            echo(obj)
        }
    }
    

    with

    C:\> fan Poo.fan "afIoc::RegistryBuilder\n{\n_moduleTypes=[afBedSheet::BedSheetModule#,afIocConfig::ConfigModule#,afBedSheet::BedSheetEnvModule#,afIocEnv::IocEnvModule#,afEfanXtra::EfanXtraModule#,afPillow::PillowModule#,afDuvet::DuvetModule#]\noptions=[\"afBedSheet.env\":\"dev\",\"afBedSheet.proxyPort\":8080,\"afBedSheet.pingProxy\":true,\"afBedSheet.appPort\":8081,\"afBedSheet.appPodName\":\"bednap\",\"afBedSheet.appName\":\"Bed Nap Tutorial\"]\nsuppressLogging=false\n}"
    

    As that should be all that BedSheet does, and for me it gives:

    fan.afIoc.RegistryBuilder@1089cc5e
    

    If it works for you, could you try this version:

    class Poo {
        Void main() {
            arg := Env.cur.args[0] 
            str := "\"" + arg.replace("\"", "\\\"") + "\""
            fan := (Str) str.toBuf.readObj
            obj := fan.toBuf.readObj
            echo(obj)
        }
    }
    

    It's almost identical but uses str.toBuf.readObj instead of str.in.readObj.

    Cheers.

  5. Steve Eynon

    Oh! Hmm... confused!

    From the stack trace, line 436 of %FAN_HOME%/src/sys/java/fanx/serialTokenizer.java throws an Err if the char \ is not followed by a valid char - such as bfnrt$"'\u but inspecting the Java cmd line you copied, it all looks fine!

    I'm gonna have to think about it tomorrow - as I'm not sure how to reproduce the Err.

  6. Steve Eynon

    I'm clutching at straws a bit here, but I wonder if AbstractMain is messing with the strings. Does this class work, with the same cmd line args?

    using util
    
    class Poo : AbstractMain {
        @Arg
        private Str? arg
    
        override Int run() {
            str := "\"" + arg.replace("\"", "\\\"") + "\""
            fan := (Str) str.toBuf.readObj
            obj := fan.toBuf.readObj
            echo(obj)
            return 0
        }
    }
    
  7. Steve Eynon

    Hmm... Okay...

    From the logs you posted, BedSheet launches the following command / process:

    java -cp /Users/Shturman/Programming/Tools/Fantom/lib/java/sys.jar -Dfan.home=/Users/Shturman/Programming/Tools/Fantom fanx.tools.Fan afBedSheet::MainProxied "afIoc::RegistryBuilder\n{\n_moduleTypes=[bednap::AppModule#,afBedSheet::BedSheetModule#,afIocConfig::ConfigModule#,afBedSheet::BedSheetEnvModule#,afIocEnv::IocEnvModule#,afEfanXtra::EfanXtraModule#,afPillow::PillowModule#,afDuvet::DuvetModule#]\noptions=[\"afBedSheet.env\":\"dev\",\"afBedSheet.appModule\":bednap::AppModule#,\"afBedSheet.proxyPort\":8080,\"afBedSheet.pingProxy\":true,\"afBedSheet.appPort\":8081,\"afBedSheet.appPodName\":\"bednap\",\"afBedSheet.appName\":\"Bed Nap Tutorial\"]\nsuppressLogging=false\n}"
    

    What happens when you run it manually? If it still dies then I think it's something to do with the newline escape chars.

  8. shturman8 NA reporter

    With proxy:

    fan afBedSheet -proxy -env dev bednap 8080
    [23:56:25 11-марта-15] [info] [afBedSheet] Found pod 'bednap'
    [23:56:25 11-марта-15] [info] [afBedSheet] Found mod 'bednap::AppModule'
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definitions from pod 'bednap'
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for bednap::AppModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afIocConfig::ConfigModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetEnvModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afIocEnv::IocEnvModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afEfanXtra::EfanXtraModule
    [23:56:25 11-марта-15] [info] [afIoc] Adding module definition for afPillow::PillowModule
    [23:56:25 11-марта-15] [info] [web] WispService started on port 8080
    [23:56:25 11-марта-15] [info] [afBedSheet] Starting BedSheet Proxy on port 8080
    [23:56:25 11-марта-15] [info] [afBedSheet] Cached the timestamps of 59 pods
    [23:56:25 11-марта-15] [info] [afBedSheet] Launching BedSheet WebApp 'Bed Nap Tutorial' on port 8081
    [23:56:25 11-марта-15] [info] [afBedSheet] Executing external process:
    
    java -cp /Users/Shturman/Programming/Tools/Fantom/lib/java/sys.jar -Dfan.home=/Users/Shturman/Programming/Tools/Fantom fanx.tools.Fan afBedSheet::MainProxied "afIoc::RegistryBuilder\n{\n_moduleTypes=[bednap::AppModule#,afBedSheet::BedSheetModule#,afIocConfig::ConfigModule#,afBedSheet::BedSheetEnvModule#,afIocEnv::IocEnvModule#,afEfanXtra::EfanXtraModule#,afPillow::PillowModule#]\noptions=[\"afBedSheet.proxyPort\":8080,\"afBedSheet.appModule\":bednap::AppModule#,\"afBedSheet.env\":\"dev\",\"afBedSheet.appPort\":8081,\"afBedSheet.appPodName\":\"bednap\",\"afBedSheet.appName\":\"Bed Nap Tutorial\",\"afBedSheet.pingProxy\":true]\nsuppressLogging=false\n}"
    
    [23:56:26 11-марта-15] [err] [MainProxied] Cannot boot
    sys::IOErr: Invalid escape sequence [Line 4]
      fanx.serial.ObjDecoder.err (ObjDecoder.java:665)
      fanx.serial.ObjDecoder.err (ObjDecoder.java:662)
      fanx.serial.Tokenizer.err (Tokenizer.java:522)
      fanx.serial.Tokenizer.escape (Tokenizer.java:436)
      fanx.serial.Tokenizer.str (Tokenizer.java:359)
      fanx.serial.Tokenizer.doNext (Tokenizer.java:76)
      fanx.serial.Tokenizer.next (Tokenizer.java:50)
      fanx.serial.ObjDecoder.consume (ObjDecoder.java:727)
      fanx.serial.ObjDecoder.<init> (ObjDecoder.java:42)
      fan.sys.InStream.readObj (InStream.java:575)
      fan.sys.InStream.readObj (InStream.java:572)
      fan.sys.Buf.readObj (Buf.java:354)
      afBedSheet::BedSheetBuilder.fromStringy (BedSheetBuilder.fan:114)
      afBedSheet::MainProxied.run (MainProxied.fan:14)
      util::AbstractMain.main (AbstractMain.fan:370)
      java.lang.reflect.Method.invoke (Method.java:483)
      fan.sys.Method.invoke (Method.java:559)
      fan.sys.Method$MethodFunc.callOn (Method.java:230)
      fan.sys.Method.callOn (Method.java:139)
      fanx.tools.Fan.callMain (Fan.java:175)
      fanx.tools.Fan.executeType (Fan.java:140)
      fanx.tools.Fan.execute (Fan.java:41)
      fanx.tools.Fan.run (Fan.java:298)
      fanx.tools.Fan.main (Fan.java:336)
    

    Without proxy:

    fan afBedSheet -env dev bednap 8080
    [23:56:40 11-марта-15] [info] [afBedSheet] Found pod 'bednap'
    [23:56:40 11-марта-15] [info] [afBedSheet] Found mod 'bednap::AppModule'
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definitions from pod 'bednap'
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for bednap::AppModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afIocConfig::ConfigModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afBedSheet::BedSheetEnvModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afIocEnv::IocEnvModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afEfanXtra::EfanXtraModule
    [23:56:40 11-марта-15] [info] [afIoc] Adding module definition for afPillow::PillowModule
    [23:56:41 11-марта-15] [info] [afBedSheet] Starting Bed App 'Bed Nap Tutorial' on port 8080
    [23:56:41 11-марта-15] [info] [web] WispService started on port 8080
    [23:56:43 11-марта-15] [info] [afIocEnv] Setting from cmd line argument '-env' : dev
    [23:56:43 11-марта-15] [info] [afIocEnv] Overriding from manual 'override' : dev
    [23:56:43 11-марта-15] [info] [afPillow]
    
    efan Library: 'app' has 2 pages:
    
      Index Page : /
       View Page : /view/*
    
    efan Library: 'app' has 1 components:
    
      Layout : app.renderLayout(Str title)
    
    [23:56:43 11-марта-15] [info] [afBedSheet]
    
    63 IoC Services:
      10 Builtin
      25 Defined
       1 Proxied
      27 Created
    
    41,27% of services are unrealised (26/63)
    
    [23:56:43 11-марта-15] [info] [afIoc]
       ___    __                 _____        _
      / _ |  / /_____  _____    / ___/__  ___/ /_________  __ __
     / _  | / // / -_|/ _  /===/ __// _ \/ _/ __/ _  / __|/ // /
    /_/ |_|/_//_/\__|/_//_/   /_/   \_,_/__/\__/____/_/   \_, /
             Alien-Factory BedSheet v1.4.8.2, IoC v2.0.6 /___/
    
    IoC Registry built in 1 336ms and started up in 1 460ms
    
    [23:56:43 11-марта-15] [info] [afBedSheet]
    
    Bed App 'Bed Nap Tutorial' listening on http://localhost:8080/
    
  9. Log in to comment