Opened 8 years ago

Closed 6 years ago

#833 closed defect (fixed)

neuromorpho and 9ML-toolkit's http-fetch tries to close output ports using close-input-port

Reported by: sjamaan Owned by: Ivan Raikov
Priority: minor Milestone:
Component: extensions Version: 4.7.x
Keywords: Cc:
Estimated difficulty:

Description (last modified by sjamaan)

Neuromorpho uses close-input-port twice in the http-fetch procedure, once for an input port and once for an output port. It looks like this means the network connection will never be closed (in Unit tcp both ports need to be closed before the underlying FD is closed).

9ML-toolkit seems to have an exact copy of that code, which shows the same problem: http://parenteses.org/mario/misc/specialize-report/install/9ML-toolkit.html

Simple fix:

Index: neuromorpho.scm
===================================================================
--- neuromorpho.scm	(revision 26685)
+++ neuromorpho.scm	(working copy)
@@ -251,7 +251,7 @@
 				    (d "reading chunks ...~%")
 				    (let ([data (read-chunks in)])
 				      (close-input-port in)
-				      (close-input-port out)
+				      (close-output-port out)
 				      (if (not (file-exists? dest)) (mkdir dest))
 				      (d "writing to ~s~%" filepath)
 				      (with-output-to-file filepath (cut display data) )
@@ -261,7 +261,7 @@
 				    (d "reading data ...~%")
 				    (let ([data (read-string #f in)])
 				      (close-input-port in)
-				      (close-input-port out)
+				      (close-output-port out)
 				      (if (not (file-exists? dest)) (mkdir dest))
 				      (d "writing to ~s~%" filepath)
 				      (with-output-to-file filepath (cut display data) binary:)

By the way, neuromorpho has no documentation on the wiki. This means it also won't show up on api.call-cc.org. Since this egg has an official release it would be nice if there was at least some documentation.

This bug was found by the scrutinizer, see http://tests.call-cc.org/master/linux/x86/2012/05/12/salmonella-report/install/neuromorpho.html

Change History (2)

comment:1 Changed 8 years ago by sjamaan

Description: modified (diff)
Summary: neuromorpho's http-fetch tries to close output ports using close-input-portneuromorpho and 9ML-toolkit's http-fetch tries to close output ports using close-input-port

comment:2 Changed 6 years ago by Ivan Raikov

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.