[Ur] Runtime error
Saulo Araujo
saulo2 at gmail.com
Fri Jul 8 14:05:49 EDT 2016
Hi Ziv,
You are right! I am quite ashamed of not remembering to check the database
state :) Thanks a lot for your help!
Sincerely,
Saulo
On Fri, Jul 8, 2016 at 2:44 PM, Ziv Scully <ziv at mit.edu> wrote:
> Hi Saulo,
>
> Exactly right about the heap. I'd be very surprised if the page blankness
> is because of heap-related issues.
>
> Nested [mapX]s are definitely okay. Maybe it's just that all of the
> [taskRows] lists are empty for some reason? (I haven't carefully read your
> queries.) Because all your xml is generated in that innermost loop, if that
> was the case, every innermost [mapX] would map over 0 things and you'd get
> no output. Perhaps try something like:
>
> fun main () =
> timeSheet <- timeSheet 1;
> return
> <xml>
> <body>
> <table>
> {case timeSheet of
> TimeSheet (projectRows) =>
> mapX (fn projectRow =>
> case projectRow of
> ProjectRow (projectId, projectName, taskRows) =>
> (**** begin new stuff ****)
> <xml>
> <tr>
> <th>{[projectId]}</th>
> <th>{[projectName]}</th>
> </tr>
> {
> (**** end new stuff ****)
> mapX (fn taskRow =>
> case taskRow of
> TaskRow (taskId, taskName, _) =>
> <xml>
> <tr>
> <td>{[projectId]}</td>
> <td>{[projectName]}</td>
> <td>{[taskId]}</td>
> <td>{[taskName]}</td>
> </tr>
> </xml>)
> taskRows)
> (**** begin new stuff ****)
> }
> </xml>
> (**** end new stuff ****)
> projectRows}
> </table>
> </body>
> </xml>
>
>
>
> On Fri, Jul 8, 2016 at 11:13 AM, Saulo Araujo <saulo2 at gmail.com> wrote:
>
>> I just found out that the messages "Error triggers unlimited retry:
>> Couldn't allocate new heap chunk contiguously; increasing size to..." are
>> not error messages, but informative ones. Also, the Ur/Web manual talks
>> about the minHeap setting. After setting it to 1024 in my project file, the
>> messages vanished, as expected. Unfortunately, my page is blank. If I
>> remove the inner mapX like below, I can see the projects stored in the
>> database. Does anyone know what I am doing wrong? Is it possible to nest
>> mapX like I did?
>>
>> {case timeSheet of
>> TimeSheet (projectRows) =>
>> mapX (fn projectRow =>
>> case projectRow of
>> ProjectRow (projectId, projectName, taskRows) =>
>> <xml>
>> <tr>
>> <td>{[projectId]}</td>
>> <td>{[projectName]}</td> (* ... *)
>>
>> Sincerely,
>> Saulo
>>
>>
>>
>> On Fri, Jul 8, 2016 at 11:38 AM, Saulo Araujo <saulo2 at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I am getting the error
>>>
>>> "Error triggers unlimited retry: Couldn't allocate new heap chunk
>>> contiguously; increasing size to 512"
>>>
>>> when I execute the following program
>>>
>>> open List
>>>
>>> table user_table: {ID: int, NAME: string} PRIMARY KEY ID
>>>
>>> table project_table: {ID: int, NAME: string, DESCRIPTION: string,
>>> USER_ID: int} PRIMARY KEY ID,
>>> CONSTRAINT USER_ID FOREIGN KEY USER_ID REFERENCES user_table(ID)
>>>
>>> table task_table: {ID: int, NAME: string, DESCRIPTION: string, USER_ID:
>>> int} PRIMARY KEY ID,
>>> CONSTRAINT USER_ID FOREIGN KEY USER_ID REFERENCES user_table(ID)
>>>
>>> table project_task_table: {PROJECT_ID: int, TASK_ID: int} PRIMARY KEY
>>> (PROJECT_ID, TASK_ID),
>>> CONSTRAINT PROJECT_ID FOREIGN KEY PROJECT_ID REFERENCES
>>> project_table (ID),
>>> CONSTRAINT TASK_ID FOREIGN KEY TASK_ID REFERENCES task_table (ID)
>>>
>>> table entry_table: {PROJECT_ID: int, TASK_ID: int, DATE: time, TIME:
>>> int} PRIMARY KEY (PROJECT_ID, TASK_ID, DATE)
>>> CONSTRAINT PROJECT_ID FOREIGN KEY PROJECT_ID REFERENCES
>>> project_table (ID),
>>> CONSTRAINT TASK_ID FOREIGN KEY TASK_ID REFERENCES task_table (ID)
>>>
>>> datatype entry_cell = EntryCell of int * float
>>>
>>> datatype task_row = TaskRow of int * string * list entry_cell
>>>
>>> datatype project_row = ProjectRow of int * string * list task_row
>>>
>>> datatype time_sheet = TimeSheet of list project_row
>>>
>>> fun timeSheet userId =
>>> projectIdTaskRowsPairs <- query (SELECT P.ID AS PROJECT_ID, T.ID AS
>>> ID, T.NAME AS NAME
>>> FROM project_table AS P
>>> INNER JOIN project_task_table AS PT ON PT.PROJECT_ID = P.ID
>>> INNER JOIN task_table AS T ON T.ID = PT.TASK_ID
>>> WHERE P.USER_ID = {[userId]}
>>> ORDER BY T.NAME)
>>> (fn r projectIdTaskRowsPairs =>
>>> let val projectIdTaskRowsPair = (r.PROJECT_ID, TaskRow (r.ID, r.NAME,
>>> [])) in
>>> return (projectIdTaskRowsPair :: projectIdTaskRowsPairs)
>>> end)
>>> [];
>>>
>>> projectRows <- query (SELECT P.ID AS ID, P.NAME AS NAME
>>> FROM project_table AS P
>>> WHERE P.USER_ID = {[userId]}
>>> ORDER BY P.NAME)
>>> (fn r projectRows =>
>>> let val projectIdTaskRowsPairs = filter (fn (projectId, _) =>
>>> projectId = r.ID) projectIdTaskRowsPairs
>>> val taskRows = mp (fn (_, taskRow) => taskRow) projectIdTaskRowsPairs
>>> val projectRow = ProjectRow (r.ID, r.NAME, taskRows)
>>> in
>>> return (projectRow :: projectRows)
>>> end)
>>> [];
>>>
>>> return (TimeSheet projectRows)
>>>
>>> fun main () =
>>> timeSheet <- timeSheet 1;
>>>
>>> return
>>> <xml>
>>> <body>
>>> <table>
>>> {case timeSheet of
>>> TimeSheet (projectRows) =>
>>> mapX (fn projectRow =>
>>> case projectRow of
>>> ProjectRow (projectId, projectName, taskRows) =>
>>> mapX (fn taskRow =>
>>> case taskRow of
>>> TaskRow (taskId, taskName, _) =>
>>> <xml>
>>> <tr>
>>> <td>{[projectId]}</td>
>>> <td>{[projectName]}</td>
>>> <td>{[taskId]}</td>
>>> <td>{[taskName]}</td>
>>> </tr>
>>> </xml>)
>>> taskRows)
>>> projectRows}
>>> </table>
>>> </body>
>>> </xml>
>>>
>>> Does anyone knows how to circumvent it? Is it possible to configure the
>>> size of the heap?
>>>
>>> Sincerely,
>>> Saulo
>>>
>>>
>>
>> _______________________________________________
>> Ur mailing list
>> Ur at impredicative.com
>> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>>
>>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20160708/af1c17f9/attachment-0001.html>
More information about the Ur
mailing list