subject is null

70 views
Skip to first unread message

tom esterez

unread,
May 31, 2011, 5:40:56 PM5/31/11
to Kayak HTTP
Hello,
Using KayakExempleProject, I get an error requesting http://localhost:8080/test-1.test
:
subject is null on method
HttpServerTransactionDelegate.OnError(Exception e).
Original error comes from HttpServerSocketDelegate.OnData(...)

var parsed = parser.Execute(data);
if (parsed != data.Count) //My values: parsed=10, data.Count=412

Did i miss something ?

Benjamin van der Veen

unread,
May 31, 2011, 6:00:25 PM5/31/11
to kayak...@googlegroups.com

Interesting. I wonder if it could have something to do with the '-'
character in the url. Does this happen every time? Does the problem go
away if you remove the '-' character? If so, this is a bug in the
parser—it should not be generating an error.

Looking over the code for HttpServerTransactionDelegate, there's
definitely a bug in the implementation of OnError—it should check to
see that the subject is not null before attempting to pass the error
to it.

Thanks!

tom esterez

unread,
May 31, 2011, 6:17:17 PM5/31/11
to Kayak HTTP
with this url, I get the same error : http://localhost:8080/test1.test
with this url, I never get any response: http://localhost:8080/test.1.test
with this url, I get an HTTP 404 as expected: http://localhost:8080/test.test


On Jun 1, 12:00 am, Benjamin van der Veen <b...@bvanderveen.com>
wrote:
> On Tue, May 31, 2011 at 2:40 PM, tom esterez <teste...@gmail.com> wrote:
> > Hello,
> > Using KayakExempleProject, I get an error requestinghttp://localhost:8080/test-1.test

Benjamin van der Veen

unread,
May 31, 2011, 6:22:42 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 3:17 PM, tom esterez <test...@gmail.com> wrote:
> with this url, I get the same error : http://localhost:8080/test1.test
> with this url, I never get any response: http://localhost:8080/test.1.test
> with this url, I get an HTTP 404 as expected: http://localhost:8080/test.test

Okay. And this is with the KayakExamples project unmodified, correct?

tom esterez

unread,
May 31, 2011, 6:23:13 PM5/31/11
to Kayak HTTP
yep

On Jun 1, 12:22 am, Benjamin van der Veen <b...@bvanderveen.com>
wrote:

Benjamin van der Veen

unread,
May 31, 2011, 6:28:21 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 3:23 PM, tom esterez <test...@gmail.com> wrote:
> yep

Awesome, thank you for the bug report. I'll look into this.

tom esterez

unread,
May 31, 2011, 7:00:44 PM5/31/11
to Kayak HTTP
I just checked out a fresh version of the Kayak project to test my bug
with the latest revision.
I get an error building the solution:
Error 2 The command """ install "C:\Users\Tom\projects\kayak\kayak
\Kayak\packages.config" -o "C:\Users\Tom\projects\kayak\kayak\Kayak\..
\packages"" exited with code 9009. C:\Users\Tom\projects\kayak\kayak
\Kayak\Kayak.csproj 132 5 Kayak

In the .csproj, I see:
<Target Name="BeforeBuild">
<Exec Command="&quot;$(NugetExeLocation)&quot; install &quot;$
(ProjectDir)packages.config&quot; -o &quot;$(MSBuildProjectDirectory)
\..\packages&quot;"/>
</Target>

$(NugetExeLocation) seems to be empty. What is it exactly ?

Thanks for your help

On Jun 1, 12:28 am, Benjamin van der Veen <b...@bvanderveen.com>
wrote:

Benjamin van der Veen

unread,
May 31, 2011, 7:10:06 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 4:00 PM, tom esterez <test...@gmail.com> wrote:
> I just checked out a fresh version of the Kayak project to test my bug
> with the latest revision.
> I get an error building the solution:
> Error   2       The command """ install "C:\Users\Tom\projects\kayak\kayak
> \Kayak\packages.config" -o "C:\Users\Tom\projects\kayak\kayak\Kayak\..
> \packages"" exited with code 9009.      C:\Users\Tom\projects\kayak\kayak
> \Kayak\Kayak.csproj     132     5       Kayak
>
> In the .csproj, I see:
> <Target Name="BeforeBuild">
>    <Exec Command="&quot;$(NugetExeLocation)&quot; install &quot;$
> (ProjectDir)packages.config&quot; -o &quot;$(MSBuildProjectDirectory)
> \..\packages&quot;"/>
>  </Target>
>
> $(NugetExeLocation) seems to be empty. What is it exactly ?
>
> Thanks for your help

The idea there was to avoid loading the NuGet packages directory into
the repo. Looks like I'll need to hard-code that into the .csproj.

To workaround:

A) Use MSBuild at the command line to build the 'build.proj' project
file in the root of the repo. This will properly set NugetExeLocation,
and create a packages dir using the nuget binary in the tools folder,
and download all the necessary packages.

- or -

B) replace the references to NugetExeLocation (in Kayak.csproj and
Kayak.Tests.csproj) with "$(MSBuildProjectDirectory)\..\tools\nuget"
(this is what I'll probably do to fix it, feel free to send a pull)

Sorry, MSBuild newbie here :S

Benjamin van der Veen

unread,
May 31, 2011, 7:19:37 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 4:10 PM, Benjamin van der Veen
<b...@bvanderveen.com> wrote:
> - or -
>
> B) replace the references to NugetExeLocation (in Kayak.csproj and
> Kayak.Tests.csproj) with "$(MSBuildProjectDirectory)\..\tools\nuget"
> (this is what I'll probably do to fix it, feel free to send a pull)

Correction: you will have to do B. Just building the build.proj on the
command line (A) won't solve the problem from within VS. I'll
definitely fix tonight after work.

tom esterez

unread,
May 31, 2011, 7:26:17 PM5/31/11
to Kayak HTTP
Build issue fixed using:
<Target Name="BeforeBuild">
<Exec Command="&quot;$(SolutionDir)\tools\nuget.exe&quot; install
&quot;$(ProjectDir)packages.config&quot; -o &quot;$
(MSBuildProjectDirectory)\..\packages&quot;"/>
</Target>

I can't reproduce my initial bug with this new build.

Benjamin van der Veen

unread,
May 31, 2011, 7:28:09 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 4:26 PM, tom esterez <test...@gmail.com> wrote:
> Build issue fixed using:
> <Target Name="BeforeBuild">
>    <Exec Command="&quot;$(SolutionDir)\tools\nuget.exe&quot; install
> &quot;$(ProjectDir)packages.config&quot; -o &quot;$
> (MSBuildProjectDirectory)\..\packages&quot;"/>
>  </Target>
>
> I can't reproduce my initial bug with this new build.

Was the bug occurring with the NuGet package?

tom esterez

unread,
May 31, 2011, 7:38:52 PM5/31/11
to Kayak HTTP
I got my previous version of Kayak using the command "git clone --
recursive g...@github.com:kayak/kayak.git" a few days ago (3?)
I had no issue building the solution (no nuget at that revision).
With the last revision checked out tonight my bug with some urls seams
to be fixed.
Did I answered your question ?

On Jun 1, 1:28 am, Benjamin van der Veen <b...@bvanderveen.com> wrote:

Benjamin van der Veen

unread,
May 31, 2011, 7:51:14 PM5/31/11
to kayak...@googlegroups.com
On Tue, May 31, 2011 at 4:38 PM, tom esterez <test...@gmail.com> wrote:
> I got my previous version of Kayak using the command "git clone --
> recursive g...@github.com:kayak/kayak.git" a few days ago (3?)
> I had no issue building the solution (no nuget at that revision).
> With the last revision checked out tonight my bug with some urls seams
> to be fixed.
> Did I answered your question ?

Ah, yes! This does make a lot of sense. The bug was in HttpMachine, it
didn't accept numbers in the URLs. Recently fixed here:
https://github.com/bvanderveen/httpmachine/pull/3

Thanks!!

tom esterez

unread,
May 31, 2011, 8:08:41 PM5/31/11
to Kayak HTTP
Great! It's nice know the causes.
Thanks for your support

On Jun 1, 1:51 am, Benjamin van der Veen <b...@bvanderveen.com> wrote:

BlessYAHU

unread,
Jun 3, 2011, 8:29:05 PM6/3/11
to Kayak HTTP
Anyone try the "/echo" route? I'm getting the following exception:

The given key was not present in the dictionary.

StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at KayakExamples.Program.RequestDelegate.OnRequest(HttpRequestHead
request, IDataProducer requestBody, IHttpResponseDelegate response) in
Program.cs: line 92
at Kayak.Http.ResponseFactory.Create(HttpRequestHead request,
IDataProducer body, Boolean shouldKeepAlive, Action end) in
HttpServerTransactionDelegate.cs: line 31

I can't see what key it is looking for.

Benjamin van der Veen

unread,
Jun 5, 2011, 12:20:06 PM6/5/11
to kayak...@googlegroups.com
Not sure why the line number in the stack trace is off, but it's
missing the Content-Length key. Make sure your request is providing
that. Eventually, when the request parser supports chunked transfer
encoding, this demo could ignore the content-length all together and
the echoing would happen transparently.

BlessYAHU

unread,
Jun 5, 2011, 3:50:02 PM6/5/11
to Kayak HTTP
I see. I made sure my request had content length by creating a page
with a button that will execute an ajax post. For some reason the
socket is being set to null in HandOffSocketIfPossible. Is that
specific to an Ajax post request?

On Jun 5, 12:20 pm, Benjamin van der Veen <b...@bvanderveen.com>
wrote:

Benjamin van der Veen

unread,
Jun 5, 2011, 4:00:05 PM6/5/11
to kayak...@googlegroups.com
On Sun, Jun 5, 2011 at 12:50 PM, BlessYAHU <barak...@gmail.com> wrote:
> I see.  I made sure my request had content length by creating a page
> with a button that will execute an ajax post.  For some reason the
> socket is being set to null in HandOffSocketIfPossible.  Is that
> specific to an Ajax post request?

Hmm, are you experiencing a different error? This
HandOffSocketIfPossible bit is part of how the HTTP code handles
pipelined requests. Each IOutputSegment represents an outgoing HTTP
message. When the IOutputSegment is done writing itself to the socket,
it hands the socket to the next segment and releases the socket (by
setting it to null). The last output segment simply closes the
connection and disposes the socket.

BlessYAHU

unread,
Jun 8, 2011, 10:11:20 AM6/8/11
to Kayak HTTP
I'll post the js I used to initiate a post tonight.

On Jun 5, 4:00 pm, Benjamin van der Veen <b...@bvanderveen.com> wrote:

BlessYAHU

unread,
Jun 15, 2011, 2:39:11 AM6/15/11
to Kayak HTTP
Wow. Sorry. :) Here it is:

$(function() {
$('.r').click(function() {
$.post('http://localhost:8080/echo',{ name: "John", time: "2pm" },
function(data) {
$('.result').html(data);
});
});
});

Benjamin van der Veen

unread,
Jun 15, 2011, 12:43:16 PM6/15/11
to kayak...@googlegroups.com
On Tue, Jun 14, 2011 at 11:39 PM, BlessYAHU <barak...@gmail.com> wrote:
> Wow. Sorry.  :) Here it is:
>
> $(function() {
> $('.r').click(function() {
> $.post('http://localhost:8080/echo',{ name: "John", time: "2pm" },
> function(data) {
> $('.result').html(data);
> });
> });
> });
>

Hm, it's tough to say what might be going on. Are you still getting
the "The given key was not present in the dictionary" error or is it a
different error? How does this relate to the socket being set to null?

Reply all
Reply to author
Forward
0 new messages