Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#4251 closed bug (invalid)

GHC hangs during Network.HTTP.simpleHTTP on Windows XP SP3, Windows 7

Reported by: balta2ar Owned by:
Priority: high Milestone: Not GHC
Component: libraries (other) Version: 6.12.3
Keywords: hang, simplehttp Cc: baltazar.bz@…, sigbjorn.finne@…, daniel@…, ganesh
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

After executing:

simpleHTTP (getRequest "http://maps.google.com/maps/api/geocode/json?address=London&sensor=false")

GHC hangs and consumes all the CPU resources (CPU load rises to 100%).

Sample log:

C:\>ghci -v -dcore-lint
GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted by GHC version 6.10.4
Using binary package database: C:\PROGRA~1\HASKEL~1\201020~1.0\lib\package.conf.d\package.cache
Using binary package database: C:\Documents and Settings\User\Application Data\ghc\i386-mingw32-6.12.3\package.conf.d\package.cache
hiding package regex-posix-0.94.2 to avoid conflict with later version regex-posix-0.94.4
hiding package base-3.0.3.2 to avoid conflict with later version base-4.2.0.2
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-2feb0cb38f65a4827135ada88c34f3ef
wired-in package integer-gmp mapped to integer-gmp-0.2.0.1-72436e28c79d056c87cc0d2d2f9f3773
wired-in package base mapped to base-4.2.0.2-0d1804f62045e52b2e806996d84f5318
wired-in package rts mapped to builtin_rts
wired-in package haskell98 mapped to haskell98-1.0.1.1-b5196101fd7a8c42a8d53bd8033d6765
wired-in package template-haskell mapped to template-haskell-2.4.0.1-401621dedd4a5f07bfd8630247358bf5
wired-in package dph-seq mapped to dph-seq-0.4.0-be069f0bb710922a6ddd4ed2b91e3a6c
wired-in package dph-par mapped to dph-par-0.4.0-b31a0ce10b7c92126978fcc929077ad6
Hsc static flags: -static
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :module +Network.HTTP
Prelude Network.HTTP> simpleHTTP (getRequest "http://maps.google.com/maps/api/geocode/json?address=London&sensor=false")
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package syb-0.1.0.2 ... linking ... done.
Loading package base-3.0.3.2 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1.7 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package bytestring-0.9.1.7 ... linking ... done.
Loading package Win32-2.2.0.2 ... linking ... done.
Loading package array-0.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.5 ... linking ... done.
Loading package HTTP-4000.0.9 ... linking ... done.
*GHC hangs here*

I'm using Windows XP SP3, Haskell Platform 2010.2.0.0. No firewall or proxy restrictions.

The bug was also reported here:
http://groups.google.com/group/haskell-cafe/browse_thread/thread/4e4a7e5eb92d1b81/48300428c7c10a57?lnk=gst&q=HTTP+package#48300428c7c10a57

There's a file in attachment with Wireshark's capture during the sample execution.

Note the same sample on ghc 6.12.1, haskell-network 2.2.1.7-3 on ArchLinux? works just fine.

Attachments (3)

simpleHTTP.pcap (3.0 KB) - added by balta2ar 4 years ago.
Wireshark's capture during simpleHTTP
0001-prevent-infinite-loop-when-reading-EOF.patch (7.3 KB) - added by dmwit 3 years ago.
patch 1/2 addressing this ticket
0002-gotta-bump-the-version-number.patch (741 bytes) - added by dmwit 3 years ago.
patch 2/2 addressing this ticket

Download all attachments as: .zip

Change History (22)

Changed 4 years ago by balta2ar

Wireshark's capture during simpleHTTP

comment:1 Changed 4 years ago by simonmar

  • Milestone set to 6.14.1
  • Priority changed from normal to high

Looks pretty serious.

comment:2 Changed 4 years ago by simonmar

Couldn't reproduce it here: Windows server 2008, GHC 6.12.1, 6.12.3 and HEAD.

comment:3 Changed 4 years ago by VenCarbon

I have the same problem when using Haskell Platform 2010.2.0.0. My OS is WinXP SP3.

Log:

D:\Documents and Settings\Admin>ghci -v -dcore-lint
GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted by GHC
version 6.10.4
Using binary package database: D:\PROGRA~1\HASKEL~1\201020~1.0\lib\package.conf.
d\package.cache
hiding package base-3.0.3.2 to avoid conflict with later version base-4.2.0.2
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-2feb0cb38f65a4827135ada88c3
4f3ef
wired-in package integer-gmp mapped to integer-gmp-0.2.0.1-72436e28c79d056c87cc0
d2d2f9f3773
wired-in package base mapped to base-4.2.0.2-0d1804f62045e52b2e806996d84f5318
wired-in package rts mapped to builtin_rts
wired-in package haskell98 mapped to haskell98-1.0.1.1-b5196101fd7a8c42a8d53bd80
33d6765
wired-in package template-haskell mapped to template-haskell-2.4.0.1-401621dedd4
a5f07bfd8630247358bf5
wired-in package dph-seq mapped to dph-seq-0.4.0-be069f0bb710922a6ddd4ed2b91e3a6
c
wired-in package dph-par mapped to dph-par-0.4.0-b31a0ce10b7c92126978fcc929077ad
6
Hsc static flags: -static
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :module +Network.HTTP
Prelude Network.HTTP> simpleHTTP (getRequest "http://maps.google.com")
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package syb-0.1.0.2 ... linking ... done.
Loading package base-3.0.3.2 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1.7 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package bytestring-0.9.1.7 ... linking ... done.
Loading package Win32-2.2.0.2 ... linking ... done.
Loading package array-0.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.5 ... linking ... done.
Loading package HTTP-4000.0.9 ... linking ... done.
*Then it stops any actions*

comment:4 Changed 4 years ago by Eridan

Confirm the bug. OS Windows 7 Professional (6.1.7600 N/A build 7600). Haskell Platform 2010.2.0.0.

Here is my output:

Microsoft Windows [Version 6.1.7600]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

C:\Users\ES>ghci -v -dcore-lint
GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
Glasgow Haskell Compiler, Version 6.12.3, for Haskell 98, stage 2 booted by GHC
version 6.10.4
Using binary package database: D:\PROGRA~1\HASKEL~1\201020~1.0\lib\package.conf.
d\package.cache
hiding package base-3.0.3.2 to avoid conflict with later version base-4.2.0.2
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-2feb0cb38f65a4827135ada88c3
4f3ef
wired-in package integer-gmp mapped to integer-gmp-0.2.0.1-72436e28c79d056c87cc0
d2d2f9f3773
wired-in package base mapped to base-4.2.0.2-0d1804f62045e52b2e806996d84f5318
wired-in package rts mapped to builtin_rts
wired-in package haskell98 mapped to haskell98-1.0.1.1-b5196101fd7a8c42a8d53bd80
33d6765
wired-in package template-haskell mapped to template-haskell-2.4.0.1-401621dedd4
a5f07bfd8630247358bf5
wired-in package dph-seq mapped to dph-seq-0.4.0-be069f0bb710922a6ddd4ed2b91e3a6
c
wired-in package dph-par mapped to dph-par-0.4.0-b31a0ce10b7c92126978fcc929077ad
6
Hsc static flags: -static
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :module +Network.HTTP
Prelude Network.HTTP> simpleHTTP (getRequest "http://maps.google.com")
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
Loading package syb-0.1.0.2 ... linking ... done.
Loading package base-3.0.3.2 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1.7 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package bytestring-0.9.1.7 ... linking ... done.
Loading package Win32-2.2.0.2 ... linking ... done.
Loading package array-0.3.0.1 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.5 ... linking ... done.
Loading package HTTP-4000.0.9 ... linking ... done.

comment:5 Changed 4 years ago by balta2ar

  • Cc baltazar.bz@… added

I've checked the bug with Haskell Platform 2010.2.0.0 on Windows Server 2003 and could not reproduce it.

Another check was made with older HaskellPlatform?-2009.2.0.2 on Windows XP SP3 and everything worked fine.

comment:6 Changed 4 years ago by igloo

  • Owner set to igloo

I can reproduce it.

comment:7 Changed 4 years ago by igloo

  • Resolution set to invalid
  • Status changed from new to closed

I don't think this is a GHC bug. This seems to be what's happening:

readLineBS calls bufferReadLine which, when it fails at EOF, calls close, closeIt, closeConnection, suck, readL, readLineBS. Loop.

comment:8 Changed 4 years ago by balta2ar

So how do I avoid looping on the specified OSes and make it working?

comment:9 Changed 4 years ago by simonmar

  • Cc sigbjorn.finne@… added

The bug is in the HTTP package, so it needs to be reported to the maintainer (I've added Sigbjorn to the CC here, so hopefully he'll see it).

comment:10 Changed 4 years ago by maeder

I've also experienced this loop under x86 and sparc solaris. The workaround is to use HTTP-4000.0.8. It works under linux by accident, because after some loops a non-EOF error is thrown, namely

shutdown: invalid argument (Transport endpoint is not connected)

Changed 3 years ago by dmwit

patch 1/2 addressing this ticket

Changed 3 years ago by dmwit

patch 2/2 addressing this ticket

comment:11 Changed 3 years ago by dmwit

  • Cc daniel@… added

I've mailed these patches to Sigbjorn, so hopefully this problem will be fixed soon.

comment:12 Changed 3 years ago by maeder

  • Architecture changed from x86 to Unknown/Multiple
  • Operating System changed from Windows to Unknown/Multiple
  • Owner igloo deleted
  • Resolution invalid deleted
  • Status changed from closed to new

This (annoying) problem is still not fixed in HTTP-4000.0.10. If this ticket is invalid here add a references to another tracker and close it as "non-ghc".

comment:13 Changed 3 years ago by simonmar

  • Milestone changed from 7.0.1 to Not GHC
  • Resolution set to invalid
  • Status changed from new to closed

As far as I know there isn't a bug tracker for HTTP. however I notified Ganesh who has offerred to do light maintainership of HTTP: http://www.haskell.org/pipermail/libraries/2010-November/014839.html.

comment:14 Changed 3 years ago by ganesh

  • Cc ganesh added

Does anyone have a way of reliably reproducing this? (i.e. one that works on all platforms)

Sorry to keep abusing the GHC trac for this; I plan to set up a new one for HTTP but the community.haskell.org webserver is down at the moment.

comment:15 Changed 3 years ago by balta2ar

The point is that the bug appears not on all platforms, but on Windows 7 and Windows XP SP3 (as far as I checked). I reproduced it in a fresh copy of Windows XP SP3 installed in VirtualBox?.

comment:16 Changed 3 years ago by ganesh

dmwit gave me a helpful tip - even though it doesn't actually go wrong on all platforms, it does loop for quite a while before it escapes. So putting in a print statement allows one to observe it on Linux.

I've now applied a patch based on his (I chose to add a new class member rather than pushing a flag around everywhere). You can get a copy from git://github.com/haskell/HTTP.git or https://github.com/haskell/HTTP

Please could all the people who had problems test this out before I release it?

comment:17 Changed 3 years ago by balta2ar

I've checked HTTP-4000.1.0 on Windows XP SP3, Haskell Platform 2010.2.0.0 and it worked OK. I'll try to check it on Windows 7 on these days.

comment:18 Changed 3 years ago by maeder

I've just tried HTTP-4000.1.0 (got as haskell-HTTP-c095af2.tar.gz) under (x86 and sparc) Solaris and it works correct now for my soap example. Thanks for your work!

comment:19 Changed 3 years ago by ganesh

Thanks for the testing, I've now uploaded to hackage.

Note: See TracTickets for help on using tickets.