简体   繁体   English

JayRock间歇性缺失值

[英]JayRock Intermittent Missing Values

I am having a problem with JayRock where I am intermittently receiving Missing Value errors. 我在JayRock遇到问题,我间歇性地收到Missing Value错误。

I cannot recreate the error but it is happening in production around 100-150 times a day (out of tens of thousands of requests). 我无法重现该错误,但它每天在生产中大约发生100-150次(成千上万的请求中)。

After investigation it has been discovered that on the requests which fail there is no [RequestBody] element in the HTTP Request. 经过调查,发现在失败的请求上,HTTP请求中没有[RequestBody]元素。

Normally it would look like this: 通常情况如下:

[urlfield] [urlfield]

[RequestBody] {"id":1,"method":"getAllAirports","params":[]} [RequestBody] {“ id”:1,“ method”:“ getAllAirports”,“ params”:[]}

[cookies] [饼干]

But in cases where it hasn't worked the request contains: 但是在无法正常工作的情况下,请求包含:

[urlfield] [urlfield]

[cookies] [饼干]

I am using the default JayRock proxy, and by using the ?test page the requests are always working. 我正在使用默认的JayRock代理,并且通过使用?test页面,请求始终有效。

Has anybody come across this before? 有人遇到过吗? Or have any ideas? 或有什么想法?

Many thanks, 非常感谢,

Iain 伊恩

UPDATE: Looking at the data it seems exclusively an error in IE, with errors in IE7, 8, 9 and 10. Although 8 has by far the most errors, even though it's traffic is comparable to 9 and less than 10. 更新:查看数据似乎完全是IE中的错误,而IE7、8、9和10中的错误。尽管8迄今为止是最多的错误,即使它的流量可以与9相比且小于10。

Seems like a parsing problem from Jayrock http://jayrock.googlecode.com/hg/src/Jayrock.Json/Json/JsonTextReader.cs 好像是来自Jayrock的解析问题http://jayrock.googlecode.com/hg/src/Jayrock.Json/Json/JsonTextReader.cs

private JsonToken Parse()
    {
        char ch = NextClean();

        //
        // String
        //

        if (ch == '"' || ch == '\'')
        {
            return Yield(JsonToken.String(NextString(ch)));
        }

        //
        // Object
        //

        if (ch == '{')
        {
            _reader.Back();
            return ParseObject();
        }

        //
        // Array
        //

        if (ch == '[')
        {
            _reader.Back();
            return ParseArray();
        }

        //
        // Handle unquoted text. This could be the values true, false, or
        // null, or it can be a number. An implementation (such as this one)
        // is allowed to also accept non-standard forms.
        //
        // Accumulate characters until we reach the end of the text or a
        // formatting character.
        // 

        StringBuilder sb = new StringBuilder();
        char b = ch;

        while (ch >= ' ' && ",:]}/\\\"[{;=#".IndexOf(ch) < 0) 
        {
            sb.Append(ch);
            ch = _reader.Next();
        }

        _reader.Back();

        string s = sb.ToString().Trim();

        if (s.Length == 0)
            throw SyntaxError("Missing value.");


        //
        // Boolean
        //

        if (s == JsonBoolean.TrueText || s == JsonBoolean.FalseText)
            return Yield(JsonToken.Boolean(s == JsonBoolean.TrueText));

        //
        // Null
        //

        if (s == JsonNull.Text)
            return Yield(JsonToken.Null());

        //
        // Number
        //
        // Try converting it. We support the 0- and 0x- conventions. 
        // If a number cannot be produced, then the value will just
        // be a string. Note that the 0-, 0x-, plus, and implied 
        // string conventions are non-standard, but a JSON text parser 
        // is free to accept non-JSON text forms as long as it accepts 
        // all correct JSON text forms.
        //

        if ((b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+')
        {
            if (b == '0' && s.Length > 1 && s.IndexOfAny(_numNonDigitChars) < 0)
            {
                if (s.Length > 2 && (s[1] == 'x' || s[1] == 'X'))
                {
                    string parsed = TryParseHex(s);
                    if (!ReferenceEquals(parsed, s))
                        return Yield(JsonToken.Number(parsed));
                }
                else
                {
                    string parsed = TryParseOctal(s);
                    if (!ReferenceEquals(parsed, s))
                        return Yield(JsonToken.Number(parsed));
                }
            }
            else
            {
                if (!JsonNumber.IsValid(s))
                    throw SyntaxError(string.Format("The text '{0}' has the incorrect syntax for a number.", s));

                return Yield(JsonToken.Number(s));
            }
        }

        //
        // Treat as String in all other cases, e.g. when unquoted.
        //

        return Yield(JsonToken.String(s));
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM