Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#33] Overflow exception with inputLine function

Date:
2009-10-15 08:16
Priority:
2
State:
Closed
Submitted by:
Bug Submitter (webuser)
Assigned to:
John Reppy (jhr)
Machine Architecture:
x86
Operating System:
Linux
Component:
Basis Library
Resolution:
Fixed
Severity:
Critical
OS Version:
2.6.18-164.el5 #1 SMP (64-bit)
SML/NJ Version:
110.70
Keywords:
IO, exception
URL:
Transcript (of reproduction):
kzhu@tucson:~/tmp$ sml test.sml Standard ML of New Jersey v110.70 [built: Thu Aug 13 10:36:44 2009] [opening test.sml] [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] uncaught exception Io [Io: inputLine failed on "abc" with exception overflow] raised at: Basis/Implementation/IO/text-io-fn.sml:119.14-119.56 /home/kfisher/sml-110.70/bin/sml: Fatal error -- Uncaught exception Io with <unk nown> raised at Basis/Implementation/IO/text-io-fn.sml:119.14-119.56
Source (for reproduction):
let val eof = ref false (* the file "abc" has 2.6M lines *) val strm = TextIO.openIn "abc" val _ = while not (!eof) do ( case TextIO.inputLine strm of SOME x => () | NONE => eof:=true ) val _ = TextIO.closeIn strm in () end
Summary:
Overflow exception with inputLine function

Detailed description
We are processing a large file, and get the following exception:

uncaught exception Io [Io: inputLine failed on "../20061214_irvpiv1.1st"
with exception overflow]
raised at Basis/Implementation/IO/text-io-fn.sml:119.14-119.56

The exception occurs after we have processed more than 2 million lines.
Submitted via web form by Kenny Zhu <kzhu@cs.sjtu.edu.cn>

Comments:

Message  ↓
Date: 2019-06-02 05:22
Sender: John Reppy

Fixed in 110.89 (Position.int is now a 64-bit type)

Date: 2011-04-08 16:41
Sender: John Reppy

To fix this bug will require switching to 64-bit integers for file positions.
Until we have an efficient implementation of 64-bit ints, this fix will probably
hurt general I/O performance too much to implement. [JHR: 2010-04-08]

Attached Files:

Changes

Field Old Value Date By
status_idOpen2019-06-02 05:22jhr
close_dateNone2019-06-02 05:22jhr
detailsWe are processing a large file, and get the following exception: uncaught exception Io [Io: inputLine failed on "../20061214_irvpiv1.1st" with exception overflow] raised at Basis/Implementation/IO/text-io-fn.sml:119.14-119.56 The exception occurs after we have processed more than 2 million lines. Submitted via web form by Kenny Zhu <kzhu@cs.sjtu.edu.cn> 2019-06-02 05:22jhr
ResolutionNone2019-06-02 05:22jhr
assigned_tonone2014-03-27 23:47jhr
priority32011-04-08 17:09jhr